annotate ltmain.sh @ 965:1a71a031f6e7

2008-11-29 Brian Masney <masneyb@gftp.org> * ltmain.sh - added new file
author masneyb
date Sat, 29 Nov 2008 14:11:04 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
965
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1 # Generated from ltmain.m4sh.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3 # ltmain.sh (GNU libtool) 2.2.4
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7 # This is free software; see the source for copying conditions. There is NO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
9
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
10 # GNU Libtool is free software; you can redistribute it and/or modify
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
11 # it under the terms of the GNU General Public License as published by
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
12 # the Free Software Foundation; either version 2 of the License, or
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
13 # (at your option) any later version.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
14 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
15 # As a special exception to the GNU General Public License,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
16 # if you distribute this file as part of a program or library that
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
17 # is built using GNU Libtool, you may include this file under the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
18 # same distribution terms that you use for the rest of that program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
19 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
20 # GNU Libtool is distributed in the hope that it will be useful, but
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
23 # General Public License for more details.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
24 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
25 # You should have received a copy of the GNU General Public License
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
26 # along with GNU Libtool; see the file COPYING. If not, a copy
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
28 # or obtained by writing to the Free Software Foundation, Inc.,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
30
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
31 # Usage: $progname [OPTION]... [MODE-ARG]...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
32 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
33 # Provide generalized library-building support services.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
34 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
35 # --config show all configuration variables
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
36 # --debug enable verbose shell tracing
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
37 # -n, --dry-run display commands without modifying any files
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
38 # --features display basic configuration information and exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
39 # --mode=MODE use operation mode MODE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
40 # --preserve-dup-deps don't remove duplicate dependency libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
41 # --quiet, --silent don't print informational messages
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
42 # --tag=TAG use configuration variables from tag TAG
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
43 # -v, --verbose print informational messages (default)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
44 # --version print version information
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
45 # -h, --help print short or long help message
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
46 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
47 # MODE must be one of the following:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
48 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
49 # clean remove files from the build directory
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
50 # compile compile a source file into a libtool object
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
51 # execute automatically set library path, then run a program
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
52 # finish complete the installation of libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
53 # install install libraries or executables
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
54 # link create a library or an executable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
55 # uninstall remove libraries from an installed directory
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
56 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
57 # MODE-ARGS vary depending on the MODE.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
59 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
60 # When reporting a bug, please describe a test case to reproduce it and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
61 # include the following information:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
62 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
63 # host-triplet: $host
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
64 # shell: $SHELL
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
65 # compiler: $LTCC
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
66 # compiler flags: $LTCFLAGS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
67 # linker: $LD (gnu? $with_gnu_ld)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
68 # $progname: (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu4
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
69 # automake: $automake_version
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
70 # autoconf: $autoconf_version
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
71 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
72 # Report bugs to <bug-libtool@gnu.org>.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
73
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
74 PROGRAM=ltmain.sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
75 PACKAGE=libtool
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
76 VERSION="2.2.4 Debian-2.2.4-0ubuntu4"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
77 TIMESTAMP=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
78 package_revision=1.2976
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
79
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
80 # Be Bourne compatible
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
82 emulate sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
83 NULLCMD=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
85 # is contrary to our usage. Disable this feature.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
86 alias -g '${1+"$@"}'='"$@"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
87 setopt NO_GLOB_SUBST
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
88 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
90 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
91 BIN_SH=xpg4; export BIN_SH # for Tru64
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
92 DUALCASE=1; export DUALCASE # for MKS sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
93
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
94 # NLS nuisances: We save the old values to restore during execute mode.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
95 # Only set LANG and LC_ALL to C if already set.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
96 # These must not be set unconditionally because not all systems understand
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
97 # e.g. LANG=C (notably SCO).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
98 lt_user_locale=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
99 lt_safe_locale=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
101 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
102 eval "if test \"\${$lt_var+set}\" = set; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
103 save_$lt_var=\$$lt_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
104 $lt_var=C
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
105 export $lt_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
108 fi"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
109 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
110
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
111 $lt_unset CDPATH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
112
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
113
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
114
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
115
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
116
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
117 : ${CP="cp -f"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
118 : ${ECHO="echo"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
119 : ${EGREP="/bin/grep -E"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
120 : ${FGREP="/bin/grep -F"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
121 : ${GREP="/bin/grep"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
122 : ${LN_S="ln -s"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
123 : ${MAKE="make"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
124 : ${MKDIR="mkdir"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
125 : ${MV="mv -f"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
126 : ${RM="rm -f"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
127 : ${SED="/bin/sed"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
129 : ${Xsed="$SED -e 1s/^X//"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
130
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
131 # Global variables:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
132 EXIT_SUCCESS=0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
133 EXIT_FAILURE=1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
136
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
137 exit_status=$EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
138
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
139 # Make sure IFS has a sensible default
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
140 lt_nl='
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
141 '
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
142 IFS=" $lt_nl"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
143
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
144 dirname="s,/[^/]*$,,"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
145 basename="s,^.*/,,"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
146
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
147 # func_dirname_and_basename file append nondir_replacement
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
148 # perform func_basename and func_dirname in a single function
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
149 # call:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
150 # dirname: Compute the dirname of FILE. If nonempty,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
151 # add APPEND to the result, otherwise set result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
152 # to NONDIR_REPLACEMENT.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
153 # value returned in "$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
154 # basename: Compute filename of FILE.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
155 # value retuned in "$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
156 # Implementation must be kept synchronized with func_dirname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
157 # and func_basename. For efficiency, we do not delegate to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
158 # those functions but instead duplicate the functionality here.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
159 func_dirname_and_basename ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
160 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
161 # Extract subdirectory from the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
163 if test "X$func_dirname_result" = "X${1}"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
164 func_dirname_result="${3}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
165 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
166 func_dirname_result="$func_dirname_result${2}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
167 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
169 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
170
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
171 # Generated shell functions inserted here.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
172
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
173 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
174 # is ksh but when the shell is invoked as "sh" and the current value of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
175 # the _XPG environment variable is not equal to 1 (one), the special
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
176 # positional parameter $0, within a function call, is the name of the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
177 # function.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
178 progpath="$0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
179
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
180 # The name of this program:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
181 # In the unlikely event $progname began with a '-', it would play havoc with
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
182 # func_echo (imagine progname=-n), so we prepend ./ in that case:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
183 func_dirname_and_basename "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
184 progname=$func_basename_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
185 case $progname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
186 -*) progname=./$progname ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
187 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
188
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
189 # Make sure we have an absolute path for reexecution:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
190 case $progpath in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
191 [\\/]*|[A-Za-z]:\\*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
192 *[\\/]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
193 progdir=$func_dirname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
194 progdir=`cd "$progdir" && pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
195 progpath="$progdir/$progname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
196 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
197 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
198 save_IFS="$IFS"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
199 IFS=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
200 for progdir in $PATH; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
201 IFS="$save_IFS"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
202 test -x "$progdir/$progname" && break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
203 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
204 IFS="$save_IFS"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
205 test -n "$progdir" || progdir=`pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
206 progpath="$progdir/$progname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
207 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
208 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
209
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
210 # Sed substitution that helps us do robust quoting. It backslashifies
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
211 # metacharacters that are still active within double-quoted strings.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
212 Xsed="${SED}"' -e 1s/^X//'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
213 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
214
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
215 # Same as above, but do not quote variable references.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
216 double_quote_subst='s/\(["`\\]\)/\\\1/g'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
217
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
218 # Re-`\' parameter expansions in output of double_quote_subst that were
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
219 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
220 # in input to double_quote_subst, that '$' was protected from expansion.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
221 # Since each input `\' is now two `\'s, look for any number of runs of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
222 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
223 bs='\\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
224 bs2='\\\\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
225 bs4='\\\\\\\\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
226 dollar='\$'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
227 sed_double_backslash="\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
228 s/$bs4/&\\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
229 /g
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
230 s/^$bs2$dollar/$bs&/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
232 s/\n//g"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
233
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
234 # Standard options:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
235 opt_dry_run=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
236 opt_help=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
237 opt_quiet=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
238 opt_verbose=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
239 opt_warning=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
240
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
241 # func_echo arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
242 # Echo program name prefixed message, along with the current mode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
243 # name if it has been set yet.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
244 func_echo ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
245 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
246 $ECHO "$progname${mode+: }$mode: $*"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
247 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
248
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
249 # func_verbose arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
250 # Echo program name prefixed message in verbose mode only.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
251 func_verbose ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
252 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
253 $opt_verbose && func_echo ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
254
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
255 # A bug in bash halts the script if the last line of a function
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
256 # fails when set -e is in force, so we need another command to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
257 # work around that:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
258 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
259 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
260
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
261 # func_error arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
262 # Echo program name prefixed message to standard error.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
263 func_error ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
264 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
266 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
267
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
268 # func_warning arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
269 # Echo program name prefixed warning message to standard error.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
270 func_warning ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
271 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
273
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
274 # bash bug again:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
275 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
276 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
277
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
278 # func_fatal_error arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
279 # Echo program name prefixed message to standard error, and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
280 func_fatal_error ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
281 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
282 func_error ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
283 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
284 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
285
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
286 # func_fatal_help arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
287 # Echo program name prefixed message to standard error, followed by
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
288 # a help hint, and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
289 func_fatal_help ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
290 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
291 func_error ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
292 func_fatal_error "$help"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
293 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
294 help="Try \`$progname --help' for more information." ## default
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
295
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
296
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
297 # func_grep expression filename
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
298 # Check whether EXPRESSION matches any line of FILENAME, without output.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
299 func_grep ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
300 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
301 $GREP "$1" "$2" >/dev/null 2>&1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
302 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
303
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
304
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
305 # func_mkdir_p directory-path
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
306 # Make sure the entire path to DIRECTORY-PATH is available.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
307 func_mkdir_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
308 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
309 my_directory_path="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
310 my_dir_list=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
311
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
313
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
314 # Protect directory names starting with `-'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
315 case $my_directory_path in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
316 -*) my_directory_path="./$my_directory_path" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
317 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
318
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
319 # While some portion of DIR does not yet exist...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
320 while test ! -d "$my_directory_path"; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
321 # ...make a list in topmost first order. Use a colon delimited
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
322 # list incase some portion of path contains whitespace.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
323 my_dir_list="$my_directory_path:$my_dir_list"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
324
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
325 # If the last portion added has no slash in it, the list is done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
326 case $my_directory_path in */*) ;; *) break ;; esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
327
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
328 # ...otherwise throw away the child directory and loop
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
330 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
332
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
333 save_mkdir_p_IFS="$IFS"; IFS=':'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
334 for my_dir in $my_dir_list; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
335 IFS="$save_mkdir_p_IFS"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
336 # mkdir can fail with a `File exist' error if two processes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
337 # try to create one of the directories concurrently. Don't
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
338 # stop in that case!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
339 $MKDIR "$my_dir" 2>/dev/null || :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
340 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
341 IFS="$save_mkdir_p_IFS"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
342
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
343 # Bail out if we (or some other process) failed to create a directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
344 test -d "$my_directory_path" || \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
345 func_fatal_error "Failed to create \`$1'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
346 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
347 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
348
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
349
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
350 # func_mktempdir [string]
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
351 # Make a temporary directory that won't clash with other running
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
352 # libtool processes, and avoids race conditions if possible. If
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
353 # given, STRING is the basename for that directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
354 func_mktempdir ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
355 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
357
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
358 if test "$opt_dry_run" = ":"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
359 # Return a directory name, but don't create it in dry-run mode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
360 my_tmpdir="${my_template}-$$"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
361 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
362
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
363 # If mktemp works, use that first and foremost
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
365
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
366 if test ! -d "$my_tmpdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
367 # Failing that, at least try and use $RANDOM to avoid a race
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
369
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
370 save_mktempdir_umask=`umask`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
371 umask 0077
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
372 $MKDIR "$my_tmpdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
373 umask $save_mktempdir_umask
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
374 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
375
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
376 # If we're not in dry-run mode, bomb out on failure
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
377 test -d "$my_tmpdir" || \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
379 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
380
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
381 $ECHO "X$my_tmpdir" | $Xsed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
382 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
383
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
384
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
385 # func_quote_for_eval arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
386 # Aesthetically quote ARG to be evaled later.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
387 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
388 # is double-quoted, suitable for a subsequent eval, whereas
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
389 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
390 # which are still active within double quotes backslashified.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
391 func_quote_for_eval ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
392 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
393 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
394 *[\\\`\"\$]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
396 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
397 func_quote_for_eval_unquoted_result="$1" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
398 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
399
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
400 case $func_quote_for_eval_unquoted_result in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
401 # Double-quote args containing shell metacharacters to delay
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
402 # word splitting, command substitution and and variable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
403 # expansion for a subsequent eval.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
404 # Many Bourne shells cannot handle close brackets correctly
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
405 # in scan sets, so we specify it separately.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
408 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
409 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
411 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
412 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
413
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
414
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
415 # func_quote_for_expand arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
416 # Aesthetically quote ARG to be evaled later; same as above,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
417 # but do not quote variable references.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
418 func_quote_for_expand ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
419 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
420 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
421 *[\\\`\"]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
422 my_arg=`$ECHO "X$1" | $Xsed \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
424 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
425 my_arg="$1" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
426 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
427
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
428 case $my_arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
429 # Double-quote args containing shell metacharacters to delay
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
430 # word splitting and command substitution for a subsequent eval.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
431 # Many Bourne shells cannot handle close brackets correctly
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
432 # in scan sets, so we specify it separately.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
434 my_arg="\"$my_arg\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
435 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
436 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
437
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
438 func_quote_for_expand_result="$my_arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
439 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
440
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
441
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
442 # func_show_eval cmd [fail_exp]
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
443 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
444 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
445 # is given, then evaluate it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
446 func_show_eval ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
447 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
448 my_cmd="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
449 my_fail_exp="${2-:}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
450
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
451 ${opt_silent-false} || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
452 func_quote_for_expand "$my_cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
453 eval "func_echo $func_quote_for_expand_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
454 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
455
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
456 if ${opt_dry_run-false}; then :; else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
457 eval "$my_cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
458 my_status=$?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
459 if test "$my_status" -eq 0; then :; else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
460 eval "(exit $my_status); $my_fail_exp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
461 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
462 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
463 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
464
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
465
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
466 # func_show_eval_locale cmd [fail_exp]
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
467 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
468 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
469 # is given, then evaluate it. Use the saved locale for evaluation.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
470 func_show_eval_locale ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
471 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
472 my_cmd="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
473 my_fail_exp="${2-:}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
474
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
475 ${opt_silent-false} || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
476 func_quote_for_expand "$my_cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
477 eval "func_echo $func_quote_for_expand_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
478 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
479
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
480 if ${opt_dry_run-false}; then :; else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
481 eval "$lt_user_locale
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
482 $my_cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
483 my_status=$?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
484 eval "$lt_safe_locale"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
485 if test "$my_status" -eq 0; then :; else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
486 eval "(exit $my_status); $my_fail_exp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
487 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
488 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
489 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
490
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
491
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
492
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
493
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
494
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
495 # func_version
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
496 # Echo version message to standard output and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
497 func_version ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
498 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
500 s/^# //
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
501 s/^# *$//
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
503 p
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
504 }' < "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
505 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
506 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
507
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
508 # func_usage
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
509 # Echo short help message to standard output and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
510 func_usage ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
511 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
512 $SED -n '/^# Usage:/,/# -h/ {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
513 s/^# //
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
514 s/^# *$//
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
515 s/\$progname/'$progname'/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
516 p
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
517 }' < "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
518 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
519 $ECHO "run \`$progname --help | more' for full usage"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
520 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
521 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
522
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
523 # func_help
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
524 # Echo long help message to standard output and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
525 func_help ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
526 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
528 s/^# //
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
529 s/^# *$//
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
530 s*\$progname*'$progname'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
531 s*\$host*'"$host"'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
532 s*\$SHELL*'"$SHELL"'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
533 s*\$LTCC*'"$LTCC"'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
535 s*\$LD*'"$LD"'*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
539 p
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
540 }' < "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
541 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
542 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
543
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
544 # func_missing_arg argname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
545 # Echo program name prefixed message to standard error and set global
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
546 # exit_cmd.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
547 func_missing_arg ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
548 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
549 func_error "missing argument for $1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
550 exit_cmd=exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
551 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
552
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
553 exit_cmd=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
554
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
555
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
556
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
557
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
558
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
559 # Check that we have a working $ECHO.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
560 if test "X$1" = X--no-reexec; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
561 # Discard the --no-reexec flag, and continue.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
562 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
563 elif test "X$1" = X--fallback-echo; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
564 # Avoid inline document here, it may be left over
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
565 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
566 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
567 # Yippee, $ECHO works!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
568 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
569 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
570 # Restart under the correct shell, and then maybe $ECHO will work.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
572 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
573
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
574 if test "X$1" = X--fallback-echo; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
575 # used as fallback echo
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
576 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
577 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
578 $*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
579 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
580 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
581 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
582
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
583 magic="%%%MAGIC variable%%%"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
584 magic_exe="%%%MAGIC EXE variable%%%"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
585
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
586 # Global variables.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
587 # $mode is unset
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
588 nonopt=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
589 execute_dlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
590 preserve_args=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
591 lo2o="s/\\.lo\$/.${objext}/"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
592 o2lo="s/\\.${objext}\$/.lo/"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
593 extracted_archives=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
594 extracted_serial=0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
595
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
596 opt_dry_run=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
597 opt_duplicate_deps=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
598 opt_silent=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
599 opt_debug=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
600
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
601 # If this variable is set in any of the actions, the command in it
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
602 # will be execed at the end. This prevents here-documents from being
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
603 # left over by shells.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
604 exec_cmd=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
605
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
606 # func_fatal_configuration arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
607 # Echo program name prefixed message to standard error, followed by
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
608 # a configuration failure hint, and exit.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
609 func_fatal_configuration ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
610 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
611 func_error ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
612 func_error "See the $PACKAGE documentation for more information."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
613 func_fatal_error "Fatal configuration error."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
614 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
615
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
616
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
617 # func_config
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
618 # Display the configuration for all the tags in this script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
619 func_config ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
620 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
621 re_begincf='^# ### BEGIN LIBTOOL'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
622 re_endcf='^# ### END LIBTOOL'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
623
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
624 # Default configuration.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
625 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
626
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
627 # Now print the configurations for the tags.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
628 for tagname in $taglist; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
629 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
630 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
631
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
632 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
633 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
634
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
635 # func_features
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
636 # Display the features supported by this script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
637 func_features ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
638 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
639 $ECHO "host: $host"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
640 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
641 $ECHO "enable shared libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
642 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
643 $ECHO "disable shared libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
644 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
645 if test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
646 $ECHO "enable static libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
647 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
648 $ECHO "disable static libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
649 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
650
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
651 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
652 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
653
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
654 # func_enable_tag tagname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
655 # Verify that TAGNAME is valid, and either flag an error and exit, or
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
656 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
657 # variable here.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
658 func_enable_tag ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
659 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
660 # Global variable:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
661 tagname="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
662
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
663 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
664 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
665 sed_extractcf="/$re_begincf/,/$re_endcf/p"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
666
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
667 # Validate tagname.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
668 case $tagname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
669 *[!-_A-Za-z0-9,/]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
670 func_fatal_error "invalid tag name: $tagname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
671 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
672 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
673
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
674 # Don't test for the "default" C tag, as we know it's
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
675 # there but not specially marked.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
676 case $tagname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
677 CC) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
678 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
679 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
680 taglist="$taglist $tagname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
681
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
682 # Evaluate the configuration. Be careful to quote the path
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
683 # and the sed script, to avoid splitting on whitespace, but
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
684 # also don't use non-portable quotes within backquotes within
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
685 # quotes we have to do it in 2 steps:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
686 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
687 eval "$extractedcf"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
688 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
689 func_error "ignoring unknown tag $tagname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
690 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
691 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
692 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
693 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
694
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
695 # Parse options once, thoroughly. This comes as soon as possible in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
696 # the script to make things like `libtool --version' happen quickly.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
697 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
698
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
699 # Shorthand for --mode=foo, only valid as the first argument
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
700 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
701 clean|clea|cle|cl)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
702 shift; set dummy --mode clean ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
703 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
704 compile|compil|compi|comp|com|co|c)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
705 shift; set dummy --mode compile ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
706 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
707 execute|execut|execu|exec|exe|ex|e)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
708 shift; set dummy --mode execute ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
709 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
710 finish|finis|fini|fin|fi|f)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
711 shift; set dummy --mode finish ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
712 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
713 install|instal|insta|inst|ins|in|i)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
714 shift; set dummy --mode install ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
715 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
716 link|lin|li|l)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
717 shift; set dummy --mode link ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
718 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
719 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
720 shift; set dummy --mode uninstall ${1+"$@"}; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
721 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
722 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
723
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
724 # Parse non-mode specific arguments:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
725 while test "$#" -gt 0; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
726 opt="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
727 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
728
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
729 case $opt in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
730 --config) func_config ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
731
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
732 --debug) preserve_args="$preserve_args $opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
733 func_echo "enabling shell trace mode"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
734 opt_debug='set -x'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
735 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
736 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
737
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
738 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
739 execute_dlfiles="$execute_dlfiles $1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
740 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
741 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
742
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
743 --dry-run | -n) opt_dry_run=: ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
744 --features) func_features ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
745 --finish) mode="finish" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
746
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
747 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
748 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
749 # Valid mode arguments:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
750 clean) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
751 compile) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
752 execute) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
753 finish) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
754 install) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
755 link) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
756 relink) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
757 uninstall) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
758
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
759 # Catch anything else as an error
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
760 *) func_error "invalid argument for $opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
761 exit_cmd=exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
762 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
763 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
764 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
765
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
766 mode="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
767 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
768 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
769
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
770 --preserve-dup-deps)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
771 opt_duplicate_deps=: ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
772
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
773 --quiet|--silent) preserve_args="$preserve_args $opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
774 opt_silent=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
775 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
776
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
777 --verbose| -v) preserve_args="$preserve_args $opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
778 opt_silent=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
779 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
780
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
781 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
782 preserve_args="$preserve_args $opt $1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
783 func_enable_tag "$1" # tagname is set here
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
784 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
785 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
786
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
787 # Separate optargs to long options:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
788 -dlopen=*|--mode=*|--tag=*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
789 func_opt_split "$opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
790 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
791 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
792 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
793
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
794 -\?|-h) func_usage ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
795 --help) opt_help=: ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
796 --version) func_version ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
797
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
798 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
799
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
800 *) nonopt="$opt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
801 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
802 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
803 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
804 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
805
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
806
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
807 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
808 *cygwin* | *mingw* | *pw32*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
809 # don't eliminate duplications in $postdeps and $predeps
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
810 opt_duplicate_compiler_generated_deps=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
811 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
812 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
813 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
814 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
815 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
816
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
817 # Having warned about all mis-specified options, bail out if
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
818 # anything was wrong.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
819 $exit_cmd $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
820 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
821
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
822 # func_check_version_match
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
823 # Ensure that we are using m4 macros, and libtool script from the same
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
824 # release of libtool.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
825 func_check_version_match ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
826 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
827 if test "$package_revision" != "$macro_revision"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
828 if test "$VERSION" != "$macro_version"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
829 if test -z "$macro_version"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
830 cat >&2 <<_LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
831 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
832 $progname: definition of this LT_INIT comes from an older release.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
833 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
834 $progname: and run autoconf again.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
835 _LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
836 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
837 cat >&2 <<_LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
838 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
839 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
840 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
841 $progname: and run autoconf again.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
842 _LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
843 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
844 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
845 cat >&2 <<_LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
846 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
847 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
848 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
849 $progname: of $PACKAGE $VERSION and run autoconf again.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
850 _LT_EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
851 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
852
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
853 exit $EXIT_MISMATCH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
854 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
855 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
856
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
857
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
858 ## ----------- ##
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
859 ## Main. ##
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
860 ## ----------- ##
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
861
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
862 $opt_help || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
863 # Sanity checks first:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
864 func_check_version_match
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
865
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
866 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
867 func_fatal_configuration "not configured to build any kind of library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
868 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
869
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
870 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
871
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
872
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
873 # Darwin sucks
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
874 eval std_shrext=\"$shrext_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
875
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
876
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
877 # Only execute mode is allowed to have -dlopen flags.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
878 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
879 func_error "unrecognized option \`-dlopen'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
880 $ECHO "$help" 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
881 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
882 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
883
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
884 # Change the help message to a mode-specific one.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
885 generic_help="$help"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
886 help="Try \`$progname --help --mode=$mode' for more information."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
887 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
888
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
889
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
890 # func_lalib_p file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
891 # True iff FILE is a libtool `.la' library or `.lo' object file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
892 # This function is only a basic sanity check; it will hardly flush out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
893 # determined imposters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
894 func_lalib_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
895 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
896 $SED -e 4q "$1" 2>/dev/null \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
897 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
898 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
899
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
900 # func_lalib_unsafe_p file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
901 # True iff FILE is a libtool `.la' library or `.lo' object file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
902 # This function implements the same check as func_lalib_p without
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
903 # resorting to external programs. To this end, it redirects stdin and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
904 # closes it afterwards, without saving the original file descriptor.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
905 # As a safety measure, use it only where a negative result would be
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
906 # fatal anyway. Works if `file' does not exist.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
907 func_lalib_unsafe_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
908 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
909 lalib_p=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
910 if test -r "$1" && exec 5<&0 <"$1"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
911 for lalib_p_l in 1 2 3 4
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
912 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
913 read lalib_p_line
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
914 case "$lalib_p_line" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
915 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
916 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
917 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
918 exec 0<&5 5<&-
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
919 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
920 test "$lalib_p" = yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
921 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
922
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
923 # func_ltwrapper_script_p file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
924 # True iff FILE is a libtool wrapper script
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
925 # This function is only a basic sanity check; it will hardly flush out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
926 # determined imposters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
927 func_ltwrapper_script_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
928 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
929 func_lalib_p "$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
930 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
931
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
932 # func_ltwrapper_executable_p file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
933 # True iff FILE is a libtool wrapper executable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
934 # This function is only a basic sanity check; it will hardly flush out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
935 # determined imposters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
936 func_ltwrapper_executable_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
937 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
938 func_ltwrapper_exec_suffix=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
939 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
940 *.exe) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
941 *) func_ltwrapper_exec_suffix=.exe ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
942 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
943 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
944 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
945
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
946 # func_ltwrapper_scriptname file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
947 # Assumes file is an ltwrapper_executable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
948 # uses $file to determine the appropriate filename for a
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
949 # temporary ltwrapper_script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
950 func_ltwrapper_scriptname ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
951 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
952 func_ltwrapper_scriptname_result=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
953 if func_ltwrapper_executable_p "$1"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
954 func_dirname_and_basename "$1" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
955 func_stripname '' '.exe' "$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
956 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
957 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
958 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
959
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
960 # func_ltwrapper_p file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
961 # True iff FILE is a libtool wrapper script or wrapper executable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
962 # This function is only a basic sanity check; it will hardly flush out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
963 # determined imposters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
964 func_ltwrapper_p ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
965 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
966 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
967 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
968
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
969
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
970 # func_execute_cmds commands fail_cmd
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
971 # Execute tilde-delimited COMMANDS.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
972 # If FAIL_CMD is given, eval that upon failure.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
973 # FAIL_CMD may read-access the current command in variable CMD!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
974 func_execute_cmds ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
975 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
976 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
977 save_ifs=$IFS; IFS='~'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
978 for cmd in $1; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
979 IFS=$save_ifs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
980 eval cmd=\"$cmd\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
981 func_show_eval "$cmd" "${2-:}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
982 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
983 IFS=$save_ifs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
984 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
985
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
986
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
987 # func_source file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
988 # Source FILE, adding directory component if necessary.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
989 # Note that it is not necessary on cygwin/mingw to append a dot to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
990 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
991 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
992 # `FILE.' does not work on cygwin managed mounts.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
993 func_source ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
994 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
995 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
996 case $1 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
997 */* | *\\*) . "$1" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
998 *) . "./$1" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
999 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1000 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1001
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1002
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1003 # func_infer_tag arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1004 # Infer tagged configuration to use if any are available and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1005 # if one wasn't chosen via the "--tag" command line option.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1006 # Only attempt this if the compiler in the base compile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1007 # command doesn't match the default compiler.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1008 # arg is usually of the form 'gcc ...'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1009 func_infer_tag ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1010 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1011 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1012 if test -n "$available_tags" && test -z "$tagname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1013 CC_quoted=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1014 for arg in $CC; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1015 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1016 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1017 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1018 case $@ in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1019 # Blanks in the command may have been stripped by the calling shell,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1020 # but not from the CC environment variable when configure was run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1021 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1022 # Blanks at the start of $base_compile will cause this to fail
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1023 # if we don't check for them as well.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1024 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1025 for z in $available_tags; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1026 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1027 # Evaluate the configuration.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1028 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1029 CC_quoted=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1030 for arg in $CC; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1031 # Double-quote args containing other shell metacharacters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1032 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1033 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1034 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1035 case "$@ " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1036 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1037 # The compiler in the base compile command matches
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1038 # the one in the tagged configuration.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1039 # Assume this is the tagged configuration we want.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1040 tagname=$z
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1041 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1042 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1043 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1044 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1045 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1046 # If $tagname still isn't set, then no tagged configuration
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1047 # was found and let the user know that the "--tag" command
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1048 # line option must be used.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1049 if test -z "$tagname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1050 func_echo "unable to infer tagged configuration"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1051 func_fatal_error "specify a tag with \`--tag'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1052 # else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1053 # func_verbose "using $tagname tagged configuration"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1054 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1055 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1056 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1057 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1058 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1059
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1060
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1061
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1062 # func_write_libtool_object output_name pic_name nonpic_name
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1063 # Create a libtool object file (analogous to a ".la" file),
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1064 # but don't create it if we're doing a dry run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1065 func_write_libtool_object ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1066 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1067 write_libobj=${1}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1068 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1069 write_lobj=\'${2}\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1070 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1071 write_lobj=none
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1072 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1073
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1074 if test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1075 write_oldobj=\'${3}\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1076 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1077 write_oldobj=none
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1078 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1079
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1080 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1081 cat >${write_libobj}T <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1082 # $write_libobj - a libtool object file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1083 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1084 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1085 # Please DO NOT delete this file!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1086 # It is necessary for linking the library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1087
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1088 # Name of the PIC object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1089 pic_object=$write_lobj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1090
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1091 # Name of the non-PIC object
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1092 non_pic_object=$write_oldobj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1093
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1094 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1095 $MV "${write_libobj}T" "${write_libobj}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1096 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1097 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1098
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1099 # func_mode_compile arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1100 func_mode_compile ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1101 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1102 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1103 # Get the compilation command and the source file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1104 base_compile=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1105 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1106 suppress_opt=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1107 suppress_output=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1108 arg_mode=normal
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1109 libobj=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1110 later=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1111 pie_flag=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1112
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1113 for arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1114 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1115 case $arg_mode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1116 arg )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1117 # do not "continue". Instead, add this to base_compile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1118 lastarg="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1119 arg_mode=normal
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1120 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1121
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1122 target )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1123 libobj="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1124 arg_mode=normal
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1125 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1126 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1127
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1128 normal )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1129 # Accept any command-line options.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1130 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1131 -o)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1132 test -n "$libobj" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1133 func_fatal_error "you cannot specify \`-o' more than once"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1134 arg_mode=target
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1135 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1136 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1137
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1138 -pie | -fpie | -fPIE)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1139 pie_flag="$pie_flag $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1140 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1141 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1142
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1143 -shared | -static | -prefer-pic | -prefer-non-pic)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1144 later="$later $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1145 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1146 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1147
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1148 -no-suppress)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1149 suppress_opt=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1150 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1151 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1152
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1153 -Xcompiler)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1154 arg_mode=arg # the next one goes into the "base_compile" arg list
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1155 continue # The current "srcfile" will either be retained or
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1156 ;; # replaced later. I would guess that would be a bug.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1157
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1158 -Wc,*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1159 func_stripname '-Wc,' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1160 args=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1161 lastarg=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1162 save_ifs="$IFS"; IFS=','
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1163 for arg in $args; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1164 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1165 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1166 lastarg="$lastarg $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1167 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1168 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1169 func_stripname ' ' '' "$lastarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1170 lastarg=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1171
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1172 # Add the arguments to base_compile.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1173 base_compile="$base_compile $lastarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1174 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1175 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1176
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1177 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1178 # Accept the current argument as the source file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1179 # The previous "srcfile" becomes the current argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1180 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1181 lastarg="$srcfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1182 srcfile="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1183 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1184 esac # case $arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1185 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1186 esac # case $arg_mode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1187
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1188 # Aesthetically quote the previous argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1189 func_quote_for_eval "$lastarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1190 base_compile="$base_compile $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1191 done # for arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1192
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1193 case $arg_mode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1194 arg)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1195 func_fatal_error "you must specify an argument for -Xcompile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1196 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1197 target)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1198 func_fatal_error "you must specify a target with \`-o'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1199 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1200 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1201 # Get the name of the library object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1202 test -z "$libobj" && {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1203 func_basename "$srcfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1204 libobj="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1205 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1206 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1207 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1208
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1209 # Recognize several different file suffixes.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1210 # If the user specifies -o file.o, it is replaced with file.lo
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1211 case $libobj in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1212 *.[cCFSifmso] | \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1213 *.ada | *.adb | *.ads | *.asm | \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1214 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1215 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1216 func_xform "$libobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1217 libobj=$func_xform_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1218 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1219 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1220
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1221 case $libobj in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1222 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1223 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1224 func_fatal_error "cannot determine name of library object from \`$libobj'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1225 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1226 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1227
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1228 func_infer_tag $base_compile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1229
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1230 for arg in $later; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1231 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1232 -shared)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1233 test "$build_libtool_libs" != yes && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1234 func_fatal_configuration "can not build a shared library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1235 build_old_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1236 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1237 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1238
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1239 -static)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1240 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1241 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1242 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1243 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1244
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1245 -prefer-pic)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1246 pic_mode=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1247 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1248 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1249
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1250 -prefer-non-pic)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1251 pic_mode=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1252 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1253 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1254 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1255 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1256
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1257 func_quote_for_eval "$libobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1258 test "X$libobj" != "X$func_quote_for_eval_result" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1259 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1260 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1261 func_dirname_and_basename "$obj" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1262 objname="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1263 xdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1264 lobj=${xdir}$objdir/$objname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1265
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1266 test -z "$base_compile" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1267 func_fatal_help "you must specify a compilation command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1268
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1269 # Delete any leftover library objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1270 if test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1271 removelist="$obj $lobj $libobj ${libobj}T"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1272 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1273 removelist="$lobj $libobj ${libobj}T"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1274 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1275
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1276 # On Cygwin there's no "real" PIC flag so we must build both object types
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1277 case $host_os in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1278 cygwin* | mingw* | pw32* | os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1279 pic_mode=default
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1280 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1281 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1282 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1283 # non-PIC code in shared libraries is not supported
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1284 pic_mode=default
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1285 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1286
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1287 # Calculate the filename of the output object if compiler does
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1288 # not support -o with -c
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1289 if test "$compiler_c_o" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1290 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1291 lockfile="$output_obj.lock"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1292 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1293 output_obj=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1294 need_locks=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1295 lockfile=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1296 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1297
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1298 # Lock this critical section if it is needed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1299 # We use this script file to make the link, it avoids creating a new file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1300 if test "$need_locks" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1301 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1302 func_echo "Waiting for $lockfile to be removed"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1303 sleep 2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1304 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1305 elif test "$need_locks" = warn; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1306 if test -f "$lockfile"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1307 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1308 *** ERROR, $lockfile exists and contains:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1309 `cat $lockfile 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1310
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1311 This indicates that another process is trying to use the same
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1312 temporary object file, and libtool could not work around it because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1313 your compiler does not support \`-c' and \`-o' together. If you
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1314 repeat this compilation, it may succeed, by chance, but you had better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1315 avoid parallel builds (make -j) in this platform, or get a better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1316 compiler."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1317
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1318 $opt_dry_run || $RM $removelist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1319 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1320 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1321 removelist="$removelist $output_obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1322 $ECHO "$srcfile" > "$lockfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1323 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1324
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1325 $opt_dry_run || $RM $removelist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1326 removelist="$removelist $lockfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1327 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1328
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1329 if test -n "$fix_srcfile_path"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1330 eval srcfile=\"$fix_srcfile_path\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1331 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1332 func_quote_for_eval "$srcfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1333 qsrcfile=$func_quote_for_eval_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1334
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1335 # Only build a PIC object if we are building libtool libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1336 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1337 # Without this assignment, base_compile gets emptied.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1338 fbsd_hideous_sh_bug=$base_compile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1339
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1340 if test "$pic_mode" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1341 command="$base_compile $qsrcfile $pic_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1342 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1343 # Don't build PIC code
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1344 command="$base_compile $qsrcfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1345 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1346
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1347 func_mkdir_p "$xdir$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1348
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1349 if test -z "$output_obj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1350 # Place PIC objects in $objdir
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1351 command="$command -o $lobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1352 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1353
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1354 func_show_eval_locale "$command" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1355 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1356
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1357 if test "$need_locks" = warn &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1358 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1359 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1360 *** ERROR, $lockfile contains:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1361 `cat $lockfile 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1362
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1363 but it should contain:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1364 $srcfile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1365
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1366 This indicates that another process is trying to use the same
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1367 temporary object file, and libtool could not work around it because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1368 your compiler does not support \`-c' and \`-o' together. If you
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1369 repeat this compilation, it may succeed, by chance, but you had better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1370 avoid parallel builds (make -j) in this platform, or get a better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1371 compiler."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1372
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1373 $opt_dry_run || $RM $removelist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1374 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1375 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1376
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1377 # Just move the object if needed, then go on to compile the next one
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1378 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1379 func_show_eval '$MV "$output_obj" "$lobj"' \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1380 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1381 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1382
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1383 # Allow error messages only from the first compilation.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1384 if test "$suppress_opt" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1385 suppress_output=' >/dev/null 2>&1'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1386 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1387 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1388
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1389 # Only build a position-dependent object if we build old libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1390 if test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1391 if test "$pic_mode" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1392 # Don't build PIC code
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1393 command="$base_compile $qsrcfile$pie_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1394 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1395 command="$base_compile $qsrcfile $pic_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1396 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1397 if test "$compiler_c_o" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1398 command="$command -o $obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1399 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1400
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1401 # Suppress compiler output if we already did a PIC compilation.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1402 command="$command$suppress_output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1403 func_show_eval_locale "$command" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1404 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1405
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1406 if test "$need_locks" = warn &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1407 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1408 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1409 *** ERROR, $lockfile contains:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1410 `cat $lockfile 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1411
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1412 but it should contain:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1413 $srcfile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1414
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1415 This indicates that another process is trying to use the same
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1416 temporary object file, and libtool could not work around it because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1417 your compiler does not support \`-c' and \`-o' together. If you
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1418 repeat this compilation, it may succeed, by chance, but you had better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1419 avoid parallel builds (make -j) in this platform, or get a better
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1420 compiler."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1421
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1422 $opt_dry_run || $RM $removelist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1423 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1424 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1425
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1426 # Just move the object if needed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1427 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1428 func_show_eval '$MV "$output_obj" "$obj"' \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1429 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1430 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1431 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1432
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1433 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1434 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1435
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1436 # Unlock the critical section if it was locked
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1437 if test "$need_locks" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1438 removelist=$lockfile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1439 $RM "$lockfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1440 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1441 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1442
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1443 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1444 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1445
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1446 $opt_help || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1447 test "$mode" = compile && func_mode_compile ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1448 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1449
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1450 func_mode_help ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1451 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1452 # We need to display help for each of the modes.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1453 case $mode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1454 "")
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1455 # Generic help is extracted from the usage comments
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1456 # at the start of this file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1457 func_help
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1458 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1459
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1460 clean)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1461 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1462 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1463
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1464 Remove files from the build directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1465
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1466 RM is the name of the program to use to delete files associated with each FILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1468 to RM.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1469
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1470 If FILE is a libtool library, object or program, all the files associated
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1471 with it are deleted. Otherwise, only FILE itself is deleted using RM."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1472 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1473
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1474 compile)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1475 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1476 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1477
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1478 Compile a source file into a libtool library object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1479
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1480 This mode accepts the following additional options:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1481
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1482 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1483 -no-suppress do not suppress compiler output for multiple passes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1484 -prefer-pic try to building PIC objects only
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1485 -prefer-non-pic try to building non-PIC objects only
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1486 -shared do not build a \`.o' file suitable for static linking
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1487 -static only build a \`.o' file suitable for static linking
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1488
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1490 from the given SOURCEFILE.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1491
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1492 The output file name is determined by removing the directory component from
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1494 library object suffix, \`.lo'."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1495 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1496
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1497 execute)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1498 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1499 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1500
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1501 Automatically set library path, then run a program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1502
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1503 This mode accepts the following additional options:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1504
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1505 -dlopen FILE add the directory containing FILE to the library path
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1506
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1507 This mode sets the library path environment variable according to \`-dlopen'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1508 flags.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1509
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1510 If any of the ARGS are libtool executable wrappers, then they are translated
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1511 into their corresponding uninstalled binary, and any of their required library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1512 directories are added to the library path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1513
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1514 Then, COMMAND is executed, with ARGS as arguments."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1515 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1516
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1517 finish)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1518 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1519 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1520
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1521 Complete the installation of libtool libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1522
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1523 Each LIBDIR is a directory that contains libtool libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1524
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1525 The commands that this mode executes may require superuser privileges. Use
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1526 the \`--dry-run' option if you just want to see what would be executed."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1527 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1528
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1529 install)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1530 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1531 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1532
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1533 Install executables or libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1534
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1535 INSTALL-COMMAND is the installation command. The first component should be
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1536 either the \`install' or \`cp' program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1537
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1538 The following components of INSTALL-COMMAND are treated specially:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1539
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1540 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1541
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1542 The rest of the components are interpreted as arguments to that command (only
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1543 BSD-compatible install options are recognized)."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1544 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1545
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1546 link)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1547 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1548 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1549
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1550 Link object files or libraries together to form another library, or to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1551 create an executable program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1552
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1553 LINK-COMMAND is a command using the C compiler that you would use to create
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1554 a program from several object files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1555
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1556 The following components of LINK-COMMAND are treated specially:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1557
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1558 -all-static do not do any dynamic linking at all
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1559 -avoid-version do not add a version suffix if possible
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1560 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1561 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1562 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1563 -export-symbols SYMFILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1564 try to export only the symbols listed in SYMFILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1565 -export-symbols-regex REGEX
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1566 try to export only the symbols matching REGEX
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1567 -LLIBDIR search LIBDIR for required installed libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1568 -lNAME OUTPUT-FILE requires the installed library libNAME
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1569 -module build a library that can dlopened
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1570 -no-fast-install disable the fast-install mode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1571 -no-install link a not-installable executable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1572 -no-undefined declare that a library does not refer to external symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1573 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1574 -objectlist FILE Use a list of object files found in FILE to specify objects
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1575 -precious-files-regex REGEX
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1576 don't remove output files matching REGEX
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1577 -release RELEASE specify package release information
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1578 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1579 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1580 -shared only do dynamic linking of libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1581 -shrext SUFFIX override the standard shared library file extension
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1582 -static do not do any dynamic linking of uninstalled libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1583 -static-libtool-libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1584 do not do any dynamic linking of libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1585 -version-info CURRENT[:REVISION[:AGE]]
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1586 specify library version info [each variable defaults to 0]
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1587 -weak LIBNAME declare that the target provides the LIBNAME interface
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1588
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1589 All other options (arguments beginning with \`-') are ignored.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1590
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1591 Every other argument is treated as a filename. Files ending in \`.la' are
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1592 treated as uninstalled libtool libraries, other files are standard or library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1593 object files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1594
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1595 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1596 only library objects (\`.lo' files) may be specified, and \`-rpath' is
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1597 required, except when creating a convenience library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1598
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1599 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1600 using \`ar' and \`ranlib', or on Windows using \`lib'.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1601
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1602 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1603 is created, otherwise an executable program is created."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1604 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1605
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1606 uninstall)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1607 $ECHO \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1608 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1609
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1610 Remove libraries from an installation directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1611
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1612 RM is the name of the program to use to delete files associated with each FILE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1613 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1614 to RM.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1615
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1616 If FILE is a libtool library, all the files associated with it are deleted.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1617 Otherwise, only FILE itself is deleted using RM."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1618 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1619
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1620 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1621 func_fatal_help "invalid operation mode \`$mode'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1622 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1623 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1624
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1625 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1626 $ECHO "Try \`$progname --help' for more information about other modes."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1627
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1628 exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1629 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1630
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1631 # Now that we've collected a possible --mode arg, show help if necessary
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1632 $opt_help && func_mode_help
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1633
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1634
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1635 # func_mode_execute arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1636 func_mode_execute ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1637 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1638 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1639 # The first argument is the command name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1640 cmd="$nonopt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1641 test -z "$cmd" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1642 func_fatal_help "you must specify a COMMAND"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1643
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1644 # Handle -dlopen flags immediately.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1645 for file in $execute_dlfiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1646 test -f "$file" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1647 || func_fatal_help "\`$file' is not a file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1648
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1649 dir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1650 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1651 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1652 # Check to see that this really is a libtool archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1653 func_lalib_unsafe_p "$file" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1654 || func_fatal_help "\`$lib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1655
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1656 # Read the libtool library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1657 dlname=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1658 library_names=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1659 func_source "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1660
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1661 # Skip this library if it cannot be dlopened.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1662 if test -z "$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1663 # Warn if it was a shared library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1664 test -n "$library_names" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1665 func_warning "\`$file' was not linked with \`-export-dynamic'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1666 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1667 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1668
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1669 func_dirname "$file" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1670 dir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1671
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1672 if test -f "$dir/$objdir/$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1673 dir="$dir/$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1674 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1675 if test ! -f "$dir/$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1676 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1677 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1678 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1679 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1680
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1681 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1682 # Just add the directory containing the .lo file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1683 func_dirname "$file" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1684 dir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1685 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1686
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1687 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1688 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1689 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1690 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1691 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1692
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1693 # Get the absolute pathname.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1694 absdir=`cd "$dir" && pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1695 test -n "$absdir" && dir="$absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1696
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1697 # Now add the directory to shlibpath_var.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1698 if eval "test -z \"\$$shlibpath_var\""; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1699 eval "$shlibpath_var=\"\$dir\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1700 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1701 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1702 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1703 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1704
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1705 # This variable tells wrapper scripts just to set shlibpath_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1706 # rather than running their programs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1707 libtool_execute_magic="$magic"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1708
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1709 # Check if any of the arguments is a wrapper script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1710 args=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1711 for file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1712 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1713 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1714 -*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1715 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1716 # Do a test to see if this is really a libtool program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1717 if func_ltwrapper_script_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1718 func_source "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1719 # Transform arg to wrapped name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1720 file="$progdir/$program"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1721 elif func_ltwrapper_executable_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1722 func_ltwrapper_scriptname "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1723 func_source "$func_ltwrapper_scriptname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1724 # Transform arg to wrapped name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1725 file="$progdir/$program"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1726 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1727 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1728 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1729 # Quote arguments (to preserve shell metacharacters).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1730 func_quote_for_eval "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1731 args="$args $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1732 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1733
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1734 if test "X$opt_dry_run" = Xfalse; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1735 if test -n "$shlibpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1736 # Export the shlibpath_var.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1737 eval "export $shlibpath_var"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1738 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1739
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1740 # Restore saved environment variables
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1741 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1742 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1743 eval "if test \"\${save_$lt_var+set}\" = set; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1744 $lt_var=\$save_$lt_var; export $lt_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1745 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1746 $lt_unset $lt_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1747 fi"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1748 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1749
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1750 # Now prepare to actually exec the command.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1751 exec_cmd="\$cmd$args"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1752 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1753 # Display what would be done.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1754 if test -n "$shlibpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1755 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1756 $ECHO "export $shlibpath_var"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1757 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1758 $ECHO "$cmd$args"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1759 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1760 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1761 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1762
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1763 test "$mode" = execute && func_mode_execute ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1764
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1765
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1766 # func_mode_finish arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1767 func_mode_finish ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1768 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1769 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1770 libdirs="$nonopt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1771 admincmds=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1772
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1773 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1774 for dir
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1775 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1776 libdirs="$libdirs $dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1777 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1778
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1779 for libdir in $libdirs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1780 if test -n "$finish_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1781 # Do each command in the finish commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1782 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1783 '"$cmd"'"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1784 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1785 if test -n "$finish_eval"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1786 # Do the single finish_eval.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1787 eval cmds=\"$finish_eval\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1788 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1789 $cmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1790 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1791 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1792 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1793
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1794 # Exit here if they wanted silent mode.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1795 $opt_silent && exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1796
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1797 $ECHO "X----------------------------------------------------------------------" | $Xsed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1798 $ECHO "Libraries have been installed in:"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1799 for libdir in $libdirs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1800 $ECHO " $libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1801 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1802 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1803 $ECHO "If you ever happen to want to link against installed libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1804 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1805 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1806 $ECHO "flag during linking and do at least one of the following:"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1807 if test -n "$shlibpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1808 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1809 $ECHO " during execution"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1810 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1811 if test -n "$runpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1812 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1813 $ECHO " during linking"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1814 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1815 if test -n "$hardcode_libdir_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1816 libdir=LIBDIR
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1817 eval flag=\"$hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1818
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1819 $ECHO " - use the \`$flag' linker flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1820 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1821 if test -n "$admincmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1822 $ECHO " - have your system administrator run these commands:$admincmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1823 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1824 if test -f /etc/ld.so.conf; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1825 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1826 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1827 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1828
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1829 $ECHO "See any operating system documentation about shared libraries for"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1830 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1831 solaris2.[6789]|solaris2.1[0-9])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1832 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1833 $ECHO "pages."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1834 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1835 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1836 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1837 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1838 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1839 $ECHO "X----------------------------------------------------------------------" | $Xsed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1840 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1841 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1842
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1843 test "$mode" = finish && func_mode_finish ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1844
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1845
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1846 # func_mode_install arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1847 func_mode_install ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1848 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1849 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1850 # There may be an optional sh(1) argument at the beginning of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1851 # install_prog (especially on Windows NT).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1852 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1853 # Allow the use of GNU shtool's install command.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1854 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1855 # Aesthetically quote it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1856 func_quote_for_eval "$nonopt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1857 install_prog="$func_quote_for_eval_result "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1858 arg=$1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1859 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1860 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1861 install_prog=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1862 arg=$nonopt
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1863 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1864
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1865 # The real first argument should be the name of the installation program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1866 # Aesthetically quote it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1867 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1868 install_prog="$install_prog$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1869
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1870 # We need to accept at least all the BSD install flags.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1871 dest=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1872 files=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1873 opts=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1874 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1875 install_type=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1876 isdir=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1877 stripme=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1878 for arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1879 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1880 if test -n "$dest"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1881 files="$files $dest"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1882 dest=$arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1883 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1884 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1885
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1886 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1887 -d) isdir=yes ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1888 -f)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1889 case " $install_prog " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1890 *[\\\ /]cp\ *) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1891 *) prev=$arg ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1892 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1893 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1894 -g | -m | -o)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1895 prev=$arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1896 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1897 -s)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1898 stripme=" -s"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1899 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1900 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1901 -*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1902 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1903 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1904 # If the previous option needed an argument, then skip it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1905 if test -n "$prev"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1906 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1907 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1908 dest=$arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1909 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1910 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1911 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1912 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1913
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1914 # Aesthetically quote the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1915 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1916 install_prog="$install_prog $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1917 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1918
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1919 test -z "$install_prog" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1920 func_fatal_help "you must specify an install program"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1921
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1922 test -n "$prev" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1923 func_fatal_help "the \`$prev' option requires an argument"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1924
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1925 if test -z "$files"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1926 if test -z "$dest"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1927 func_fatal_help "no file or destination specified"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1928 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1929 func_fatal_help "you must specify a destination"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1930 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1931 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1932
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1933 # Strip any trailing slash from the destination.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1934 func_stripname '' '/' "$dest"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1935 dest=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1936
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1937 # Check to see that the destination is a directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1938 test -d "$dest" && isdir=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1939 if test "$isdir" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1940 destdir="$dest"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1941 destname=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1942 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1943 func_dirname_and_basename "$dest" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1944 destdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1945 destname="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1946
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1947 # Not a directory, so check to see that there is only one file specified.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1948 set dummy $files; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1949 test "$#" -gt 1 && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1950 func_fatal_help "\`$dest' is not a directory"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1951 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1952 case $destdir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1953 [\\/]* | [A-Za-z]:[\\/]*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1954 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1955 for file in $files; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1956 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1957 *.lo) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1958 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1959 func_fatal_help "\`$destdir' must be an absolute directory name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1960 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1961 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1962 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1963 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1964 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1965
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1966 # This variable tells wrapper scripts just to set variables rather
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1967 # than running their programs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1968 libtool_install_magic="$magic"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1969
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1970 staticlibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1971 future_libdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1972 current_libdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1973 for file in $files; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1974
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1975 # Do each installation.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1976 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1977 *.$libext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1978 # Do the static libraries later.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1979 staticlibs="$staticlibs $file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1980 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1981
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1982 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1983 # Check to see that this really is a libtool archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1984 func_lalib_unsafe_p "$file" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1985 || func_fatal_help "\`$file' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1986
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1987 library_names=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1988 old_library=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1989 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1990 func_source "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1991
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1992 # Add the libdir to current_libdirs if it is the destination.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1993 if test "X$destdir" = "X$libdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1994 case "$current_libdirs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1995 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1996 *) current_libdirs="$current_libdirs $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1997 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1998 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1999 # Note the libdir as a future libdir.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2000 case "$future_libdirs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2001 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2002 *) future_libdirs="$future_libdirs $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2003 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2004 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2005
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2006 func_dirname "$file" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2007 dir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2008 dir="$dir$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2009
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2010 if test -n "$relink_command"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2011 # Determine the prefix the user has applied to our future dir.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2012 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2013
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2014 # Don't allow the user to place us outside of our expected
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2015 # location b/c this prevents finding dependent libraries that
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2016 # are installed to the same prefix.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2017 # At present, this check doesn't affect windows .dll's that
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2018 # are installed into $libdir/../bin (currently, that works fine)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2019 # but it's something to keep an eye on.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2020 test "$inst_prefix_dir" = "$destdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2021 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2022
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2023 if test -n "$inst_prefix_dir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2024 # Stick the inst_prefix_dir data into the link command.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2025 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2026 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2027 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2028 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2029
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2030 func_warning "relinking \`$file'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2031 func_show_eval "$relink_command" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2032 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2033 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2034
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2035 # See the names of the shared library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2036 set dummy $library_names; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2037 if test -n "$1"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2038 realname="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2039 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2040
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2041 srcname="$realname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2042 test -n "$relink_command" && srcname="$realname"T
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2043
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2044 # Install the shared library and build the symlinks.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2045 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2046 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2047 tstripme="$stripme"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2048 case $host_os in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2049 cygwin* | mingw* | pw32*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2050 case $realname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2051 *.dll.a)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2052 tstripme=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2053 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2054 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2055 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2056 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2057 if test -n "$tstripme" && test -n "$striplib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2058 func_show_eval "$striplib $destdir/$realname" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2059 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2060
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2061 if test "$#" -gt 0; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2062 # Delete the old symlinks, and create new ones.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2063 # Try `ln -sf' first, because the `ln' binary might depend on
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2064 # the symlink we replace! Solaris /bin/ln does not understand -f,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2065 # so we also need to try rm && ln -s.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2066 for linkname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2067 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2068 test "$linkname" != "$realname" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2069 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2070 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2071 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2072
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2073 # Do each command in the postinstall commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2074 lib="$destdir/$realname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2075 func_execute_cmds "$postinstall_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2076 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2077
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2078 # Install the pseudo-library for information purposes.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2079 func_basename "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2080 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2081 instname="$dir/$name"i
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2082 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2083
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2084 # Maybe install the static library, too.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2085 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2086 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2087
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2088 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2089 # Install (i.e. copy) a libtool object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2090
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2091 # Figure out destination file name, if it wasn't already specified.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2092 if test -n "$destname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2093 destfile="$destdir/$destname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2094 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2095 func_basename "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2096 destfile="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2097 destfile="$destdir/$destfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2098 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2099
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2100 # Deduce the name of the destination old-style object file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2101 case $destfile in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2102 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2103 func_lo2o "$destfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2104 staticdest=$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2105 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2106 *.$objext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2107 staticdest="$destfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2108 destfile=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2109 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2110 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2111 func_fatal_help "cannot copy a libtool object to \`$destfile'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2112 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2113 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2114
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2115 # Install the libtool object if requested.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2116 test -n "$destfile" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2117 func_show_eval "$install_prog $file $destfile" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2118
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2119 # Install the old object if enabled.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2120 if test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2121 # Deduce the name of the old-style object file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2122 func_lo2o "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2123 staticobj=$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2124 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2125 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2126 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2127 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2128
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2129 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2130 # Figure out destination file name, if it wasn't already specified.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2131 if test -n "$destname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2132 destfile="$destdir/$destname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2133 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2134 func_basename "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2135 destfile="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2136 destfile="$destdir/$destfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2137 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2138
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2139 # If the file is missing, and there is a .exe on the end, strip it
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2140 # because it is most likely a libtool script we actually want to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2141 # install
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2142 stripped_ext=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2143 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2144 *.exe)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2145 if test ! -f "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2146 func_stripname '' '.exe' "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2147 file=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2148 stripped_ext=".exe"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2149 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2150 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2151 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2152
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2153 # Do a test to see if this is really a libtool program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2154 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2155 *cygwin*|*mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2156 if func_ltwrapper_executable_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2157 func_ltwrapper_scriptname "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2158 wrapper=$func_ltwrapper_scriptname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2159 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2160 func_stripname '' '.exe' "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2161 wrapper=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2162 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2163 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2164 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2165 wrapper=$file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2166 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2167 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2168 if func_ltwrapper_script_p "$wrapper"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2169 notinst_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2170 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2171
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2172 func_source "$wrapper"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2173
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2174 # Check the variables that should have been set.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2175 test -z "$generated_by_libtool_version" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2176 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2177
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2178 finalize=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2179 for lib in $notinst_deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2180 # Check to see that each library is installed.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2181 libdir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2182 if test -f "$lib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2183 func_source "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2184 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2185 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2186 if test -n "$libdir" && test ! -f "$libfile"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2187 func_warning "\`$lib' has not been installed in \`$libdir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2188 finalize=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2189 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2190 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2191
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2192 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2193 func_source "$wrapper"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2194
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2195 outputname=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2196 if test "$fast_install" = no && test -n "$relink_command"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2197 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2198 if test "$finalize" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2199 tmpdir=`func_mktempdir`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2200 func_basename "$file$stripped_ext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2201 file="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2202 outputname="$tmpdir/$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2203 # Replace the output file specification.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2204 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2205
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2206 $opt_silent || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2207 func_quote_for_expand "$relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2208 eval "func_echo $func_quote_for_expand_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2209 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2210 if eval "$relink_command"; then :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2211 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2212 func_error "error: relink \`$file' with the above command before installing it"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2213 $opt_dry_run || ${RM}r "$tmpdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2214 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2215 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2216 file="$outputname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2217 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2218 func_warning "cannot relink \`$file'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2219 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2220 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2221 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2222 # Install the binary that we compiled earlier.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2223 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2224 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2225 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2226
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2227 # remove .exe since cygwin /usr/bin/install will append another
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2228 # one anyway
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2229 case $install_prog,$host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2230 */usr/bin/install*,*cygwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2231 case $file:$destfile in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2232 *.exe:*.exe)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2233 # this is ok
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2234 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2235 *.exe:*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2236 destfile=$destfile.exe
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2237 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2238 *:*.exe)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2239 func_stripname '' '.exe' "$destfile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2240 destfile=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2241 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2242 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2243 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2244 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2245 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2246 $opt_dry_run || if test -n "$outputname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2247 ${RM}r "$tmpdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2248 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2249 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2250 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2251 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2252
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2253 for file in $staticlibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2254 func_basename "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2255 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2256
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2257 # Set up the ranlib parameters.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2258 oldlib="$destdir/$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2259
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2260 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2261
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2262 if test -n "$stripme" && test -n "$old_striplib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2263 func_show_eval "$old_striplib $oldlib" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2264 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2265
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2266 # Do each command in the postinstall commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2267 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2268 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2269
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2270 test -n "$future_libdirs" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2271 func_warning "remember to run \`$progname --finish$future_libdirs'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2272
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2273 if test -n "$current_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2274 # Maybe just do a dry run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2275 $opt_dry_run && current_libdirs=" -n$current_libdirs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2276 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2277 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2278 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2279 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2280 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2281
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2282 test "$mode" = install && func_mode_install ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2283
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2284
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2285 # func_generate_dlsyms outputname originator pic_p
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2286 # Extract symbols from dlprefiles and create ${outputname}S.o with
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2287 # a dlpreopen symbol table.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2288 func_generate_dlsyms ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2289 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2290 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2291 my_outputname="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2292 my_originator="$2"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2293 my_pic_p="${3-no}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2294 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2295 my_dlsyms=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2296
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2297 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2298 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2299 my_dlsyms="${my_outputname}S.c"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2300 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2301 func_error "not configured to extract global symbols from dlpreopened files"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2302 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2303 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2304
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2305 if test -n "$my_dlsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2306 case $my_dlsyms in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2307 "") ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2308 *.c)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2309 # Discover the nlist of each of the dlfiles.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2310 nlist="$output_objdir/${my_outputname}.nm"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2311
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2312 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2313
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2314 # Parse the name list into a source file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2315 func_verbose "creating $output_objdir/$my_dlsyms"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2316
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2317 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2318 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2319 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2320
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2321 #ifdef __cplusplus
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2322 extern \"C\" {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2323 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2324
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2325 /* External symbol declarations for the compiler. */\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2326 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2327
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2328 if test "$dlself" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2329 func_verbose "generating symbol list for \`$output'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2330
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2331 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2332
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2333 # Add our own program objects to the symbol list.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2334 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2335 for progfile in $progfiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2336 func_verbose "extracting global C symbols from \`$progfile'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2337 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2338 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2339
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2340 if test -n "$exclude_expsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2341 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2342 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2343 eval '$MV "$nlist"T "$nlist"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2344 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2345 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2346
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2347 if test -n "$export_symbols_regex"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2348 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2349 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2350 eval '$MV "$nlist"T "$nlist"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2351 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2352 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2353
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2354 # Prepare the list of exported symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2355 if test -z "$export_symbols"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2356 export_symbols="$output_objdir/$outputname.exp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2357 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2358 $RM $export_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2359 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2360 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2361 *cygwin* | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2362 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2363 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2364 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2365 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2366 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2367 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2368 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2369 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2370 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2371 eval '$MV "$nlist"T "$nlist"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2372 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2373 *cygwin | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2374 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2375 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2376 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2377 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2378 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2379 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2380 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2381
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2382 for dlprefile in $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2383 func_verbose "extracting global C symbols from \`$dlprefile'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2384 func_basename "$dlprefile"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2385 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2386 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2387 eval '$ECHO ": $name " >> "$nlist"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2388 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2389 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2390 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2391
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2392 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2393 # Make sure we have at least an empty file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2394 test -f "$nlist" || : > "$nlist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2395
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2396 if test -n "$exclude_expsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2397 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2398 $MV "$nlist"T "$nlist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2399 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2400
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2401 # Try sorting and uniquifying the output.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2402 if $GREP -v "^: " < "$nlist" |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2403 if sort -k 3 </dev/null >/dev/null 2>&1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2404 sort -k 3
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2405 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2406 sort +2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2407 fi |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2408 uniq > "$nlist"S; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2409 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2410 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2411 $GREP -v "^: " < "$nlist" > "$nlist"S
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2412 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2413
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2414 if test -f "$nlist"S; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2415 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2416 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2417 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2418 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2419
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2420 $ECHO >> "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2421
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2422 /* The mapping between symbol names and symbols. */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2423 typedef struct {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2424 const char *name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2425 void *address;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2426 } lt_dlsymlist;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2427 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2428 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2429 *cygwin* | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2430 $ECHO >> "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2431 /* DATA imports from DLLs on WIN32 con't be const, because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2432 runtime relocations are performed -- see ld's documentation
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2433 on pseudo-relocs. */"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2434 lt_dlsym_const= ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2435 *osf5*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2436 echo >> "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2437 /* This system does not cope well with relocations in const data */"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2438 lt_dlsym_const= ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2439 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2440 lt_dlsym_const=const ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2441 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2442
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2443 $ECHO >> "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2444 extern $lt_dlsym_const lt_dlsymlist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2445 lt_${my_prefix}_LTX_preloaded_symbols[];
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2446 $lt_dlsym_const lt_dlsymlist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2447 lt_${my_prefix}_LTX_preloaded_symbols[] =
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2448 {\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2449 { \"$my_originator\", (void *) 0 },"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2450
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2451 case $need_lib_prefix in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2452 no)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2453 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2454 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2455 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2456 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2457 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2458 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2459 $ECHO >> "$output_objdir/$my_dlsyms" "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2460 {0, (void *) 0}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2461 };
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2462
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2463 /* This works around a problem in FreeBSD linker */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2464 #ifdef FREEBSD_WORKAROUND
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2465 static const void *lt_preloaded_setup() {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2466 return lt_${my_prefix}_LTX_preloaded_symbols;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2467 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2468 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2469
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2470 #ifdef __cplusplus
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2471 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2472 #endif\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2473 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2474 } # !$opt_dry_run
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2475
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2476 pic_flag_for_symtable=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2477 case "$compile_command " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2478 *" -static "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2479 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2480 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2481 # compiling the symbol table file with pic_flag works around
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2482 # a FreeBSD bug that causes programs to crash when -lm is
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2483 # linked before any other PIC object. But we must not use
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2484 # pic_flag when linking with -static. The problem exists in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2485 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2486 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2487 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2488 *-*-hpux*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2489 pic_flag_for_symtable=" $pic_flag" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2490 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2491 if test "X$my_pic_p" != Xno; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2492 pic_flag_for_symtable=" $pic_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2493 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2494 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2495 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2496 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2497 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2498 symtab_cflags=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2499 for arg in $LTCFLAGS; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2500 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2501 -pie | -fpie | -fPIE) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2502 *) symtab_cflags="$symtab_cflags $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2503 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2504 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2505
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2506 # Now compile the dynamic symbol file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2507 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2508
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2509 # Clean up the generated files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2510 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2511
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2512 # Transform the symbol file into the correct name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2513 symfileobj="$output_objdir/${my_outputname}S.$objext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2514 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2515 *cygwin* | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2516 if test -f "$output_objdir/$my_outputname.def"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2517 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2518 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2519 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2520 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2521 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2522 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2523 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2524 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2525 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2526 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2527 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2528 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2529 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2530 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2531 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2532 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2533 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2534 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2535 # We keep going just in case the user didn't refer to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2536 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2537 # really was required.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2538
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2539 # Nullify the symbol file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2540 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2541 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2542 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2543 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2544
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2545 # func_win32_libid arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2546 # return the library type of file 'arg'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2547 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2548 # Need a lot of goo to handle *both* DLLs and import libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2549 # Has to be a shell function in order to 'eat' the argument
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2550 # that is supplied when $file_magic_command is called.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2551 func_win32_libid ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2552 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2553 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2554 win32_libid_type="unknown"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2555 win32_fileres=`file -L $1 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2556 case $win32_fileres in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2557 *ar\ archive\ import\ library*) # definitely import
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2558 win32_libid_type="x86 archive import"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2559 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2560 *ar\ archive*) # could be an import, or static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2561 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2562 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2563 win32_nmres=`eval $NM -f posix -A $1 |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2564 $SED -n -e '
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2565 1,100{
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2566 / I /{
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2567 s,.*,import,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2568 p
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2569 q
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2570 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2571 }'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2572 case $win32_nmres in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2573 import*) win32_libid_type="x86 archive import";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2574 *) win32_libid_type="x86 archive static";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2575 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2576 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2577 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2578 *DLL*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2579 win32_libid_type="x86 DLL"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2580 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2581 *executable*) # but shell scripts are "executable" too...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2582 case $win32_fileres in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2583 *MS\ Windows\ PE\ Intel*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2584 win32_libid_type="x86 DLL"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2585 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2586 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2587 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2588 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2589 $ECHO "$win32_libid_type"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2590 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2591
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2592
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2593
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2594 # func_extract_an_archive dir oldlib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2595 func_extract_an_archive ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2596 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2597 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2598 f_ex_an_ar_dir="$1"; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2599 f_ex_an_ar_oldlib="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2600 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2601 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2602 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2603 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2604 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2605 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2606 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2607
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2608
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2609 # func_extract_archives gentop oldlib ...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2610 func_extract_archives ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2611 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2612 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2613 my_gentop="$1"; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2614 my_oldlibs=${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2615 my_oldobjs=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2616 my_xlib=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2617 my_xabs=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2618 my_xdir=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2619
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2620 for my_xlib in $my_oldlibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2621 # Extract the objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2622 case $my_xlib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2623 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2624 *) my_xabs=`pwd`"/$my_xlib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2625 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2626 func_basename "$my_xlib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2627 my_xlib="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2628 my_xlib_u=$my_xlib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2629 while :; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2630 case " $extracted_archives " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2631 *" $my_xlib_u "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2632 func_arith $extracted_serial + 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2633 extracted_serial=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2634 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2635 *) break ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2636 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2637 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2638 extracted_archives="$extracted_archives $my_xlib_u"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2639 my_xdir="$my_gentop/$my_xlib_u"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2640
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2641 func_mkdir_p "$my_xdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2642
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2643 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2644 *-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2645 func_verbose "Extracting $my_xabs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2646 # Do not bother doing anything if just a dry run
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2647 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2648 darwin_orig_dir=`pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2649 cd $my_xdir || exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2650 darwin_archive=$my_xabs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2651 darwin_curdir=`pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2652 darwin_base_archive=`basename "$darwin_archive"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2653 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2654 if test -n "$darwin_arches"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2655 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2656 darwin_arch=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2657 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2658 for darwin_arch in $darwin_arches ; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2659 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2660 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2661 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2662 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2663 cd "$darwin_curdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2664 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2665 done # $darwin_arches
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2666 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2667 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2668 darwin_file=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2669 darwin_files=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2670 for darwin_file in $darwin_filelist; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2671 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2672 $LIPO -create -output "$darwin_file" $darwin_files
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2673 done # $darwin_filelist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2674 $RM -rf unfat-$$
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2675 cd "$darwin_orig_dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2676 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2677 cd $darwin_orig_dir
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2678 func_extract_an_archive "$my_xdir" "$my_xabs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2679 fi # $darwin_arches
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2680 } # !$opt_dry_run
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2681 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2682 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2683 func_extract_an_archive "$my_xdir" "$my_xabs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2684 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2685 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2686 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2687 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2688
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2689 func_extract_archives_result="$my_oldobjs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2690 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2691
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2692
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2693
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2694 # func_emit_wrapper arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2695 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2696 # emit a libtool wrapper script on stdout
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2697 # don't directly open a file because we may want to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2698 # incorporate the script contents within a cygwin/mingw
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2699 # wrapper executable. Must ONLY be called from within
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2700 # func_mode_link because it depends on a number of variable
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2701 # set therein.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2702 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2703 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2704 # variable will take. If 'yes', then the emitted script
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2705 # will assume that the directory in which it is stored is
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2706 # the '.lib' directory. This is a cygwin/mingw-specific
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2707 # behavior.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2708 func_emit_wrapper ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2709 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2710 func_emit_wrapper_arg1=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2711 if test -n "$1" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2712 func_emit_wrapper_arg1=$1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2713 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2714
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2715 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2716 #! $SHELL
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2717
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2718 # $output - temporary wrapper script for $objdir/$outputname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2719 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2720 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2721 # The $output program cannot be directly executed until all the libtool
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2722 # libraries that it depends on are installed.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2723 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2724 # This wrapper script should never be moved out of the build directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2725 # If it is, it will not operate correctly.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2726
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2727 # Sed substitution that helps us do robust quoting. It backslashifies
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2728 # metacharacters that are still active within double-quoted strings.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2729 Xsed='${SED} -e 1s/^X//'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2730 sed_quote_subst='$sed_quote_subst'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2731
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2732 # Be Bourne compatible
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2733 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2734 emulate sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2735 NULLCMD=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2736 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2737 # is contrary to our usage. Disable this feature.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2738 alias -g '\${1+\"\$@\"}'='\"\$@\"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2739 setopt NO_GLOB_SUBST
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2740 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2741 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2742 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2743 BIN_SH=xpg4; export BIN_SH # for Tru64
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2744 DUALCASE=1; export DUALCASE # for MKS sh
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2745
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2746 # The HP-UX ksh and POSIX shell print the target directory to stdout
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2747 # if CDPATH is set.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2748 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2749
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2750 relink_command=\"$relink_command\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2751
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2752 # This environment variable determines our operation mode.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2753 if test \"\$libtool_install_magic\" = \"$magic\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2754 # install mode needs the following variables:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2755 generated_by_libtool_version='$macro_version'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2756 notinst_deplibs='$notinst_deplibs'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2757 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2758 # When we are sourced in execute mode, \$file and \$ECHO are already set.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2759 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2760 ECHO=\"$qecho\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2761 file=\"\$0\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2762 # Make sure echo works.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2763 if test \"X\$1\" = X--no-reexec; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2764 # Discard the --no-reexec flag, and continue.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2765 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2766 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2767 # Yippee, \$ECHO works!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2768 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2769 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2770 # Restart under the correct shell, and then maybe \$ECHO will work.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2771 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2772 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2773 fi\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2774 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2775 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2776
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2777 # Find the directory that this script lives in.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2778 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2779 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2780
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2781 # Follow symbolic links until we get to the real thisdir.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2782 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2783 while test -n \"\$file\"; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2784 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2785
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2786 # If there was a directory component, then change thisdir.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2787 if test \"x\$destdir\" != \"x\$file\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2788 case \"\$destdir\" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2789 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2790 *) thisdir=\"\$thisdir/\$destdir\" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2791 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2792 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2793
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2794 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2795 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2796 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2797
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2798 # Usually 'no', except on cygwin/mingw when embedded into
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2799 # the cwrapper.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2800 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2801 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2802 # special case for '.'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2803 if test \"\$thisdir\" = \".\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2804 thisdir=\`pwd\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2805 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2806 # remove .libs from thisdir
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2807 case \"\$thisdir\" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2808 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2809 $objdir ) thisdir=. ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2810 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2811 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2812
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2813 # Try to get the absolute directory name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2814 absdir=\`cd \"\$thisdir\" && pwd\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2815 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2816 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2817
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2818 if test "$fast_install" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2819 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2820 program=lt-'$outputname'$exeext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2821 progdir=\"\$thisdir/$objdir\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2822
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2823 if test ! -f \"\$progdir/\$program\" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2824 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2825 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2826
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2827 file=\"\$\$-\$program\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2828
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2829 if test ! -d \"\$progdir\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2830 $MKDIR \"\$progdir\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2831 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2832 $RM \"\$progdir/\$file\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2833 fi"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2834
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2835 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2836
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2837 # relink executable if necessary
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2838 if test -n \"\$relink_command\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2839 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2840 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2841 $ECHO \"\$relink_command_output\" >&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2842 $RM \"\$progdir/\$file\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2843 exit 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2844 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2845 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2846
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2847 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2848 { $RM \"\$progdir/\$program\";
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2849 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2850 $RM \"\$progdir/\$file\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2851 fi"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2852 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2853 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2854 program='$outputname'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2855 progdir=\"\$thisdir/$objdir\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2856 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2857 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2858
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2859 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2860
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2861 if test -f \"\$progdir/\$program\"; then"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2862
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2863 # Export our shlibpath_var if we have one.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2864 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2865 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2866 # Add our own library path to $shlibpath_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2867 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2868
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2869 # Some systems cannot cope with colon-terminated $shlibpath_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2870 # The second colon is a workaround for a bug in BeOS R4 sed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2871 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2872
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2873 export $shlibpath_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2874 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2875 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2876
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2877 # fixup the dll searchpath if we need to.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2878 if test -n "$dllsearchpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2879 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2880 # Add the dll search path components to the executable PATH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2881 PATH=$dllsearchpath:\$PATH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2882 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2883 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2884
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2885 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2886 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2887 # Run the actual program with our arguments.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2888 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2889 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2890 # Backslashes separate directories on plain windows
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2891 *-*-mingw | *-*-os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2892 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2893 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2894 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2895 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2896
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2897 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2898 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2899 exec \"\$progdir/\$program\" \${1+\"\$@\"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2900 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2901 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2902 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2903 $ECHO "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2904 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2905 exit 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2906 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2907 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2908 # The program doesn't exist.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2909 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2910 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2911 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2912 exit 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2913 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2914 fi\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2915 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2916 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2917 # end: func_emit_wrapper
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2918
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2919 # func_emit_cwrapperexe_src
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2920 # emit the source code for a wrapper executable on stdout
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2921 # Must ONLY be called from within func_mode_link because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2922 # it depends on a number of variable set therein.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2923 func_emit_cwrapperexe_src ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2924 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2925 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2926
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2927 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2928 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2929
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2930 The $output program cannot be directly executed until all the libtool
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2931 libraries that it depends on are installed.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2932
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2933 This wrapper executable should never be moved out of the build directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2934 If it is, it will not operate correctly.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2935
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2936 Currently, it simply execs the wrapper *script* "$SHELL $output",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2937 but could eventually absorb all of the scripts functionality and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2938 exec $objdir/$outputname directly.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2939 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2940 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2941 cat <<"EOF"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2942 #include <stdio.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2943 #include <stdlib.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2944 #ifdef _MSC_VER
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2945 # include <direct.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2946 # include <process.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2947 # include <io.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2948 # define setmode _setmode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2949 #else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2950 # include <unistd.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2951 # include <stdint.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2952 # ifdef __CYGWIN__
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2953 # include <io.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2954 # endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2955 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2956 #include <malloc.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2957 #include <stdarg.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2958 #include <assert.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2959 #include <string.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2960 #include <ctype.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2961 #include <errno.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2962 #include <fcntl.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2963 #include <sys/stat.h>
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2964
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2965 #if defined(PATH_MAX)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2966 # define LT_PATHMAX PATH_MAX
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2967 #elif defined(MAXPATHLEN)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2968 # define LT_PATHMAX MAXPATHLEN
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2969 #else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2970 # define LT_PATHMAX 1024
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2971 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2972
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2973 #ifndef S_IXOTH
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2974 # define S_IXOTH 0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2975 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2976 #ifndef S_IXGRP
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2977 # define S_IXGRP 0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2978 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2979
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2980 #ifdef _MSC_VER
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2981 # define S_IXUSR _S_IEXEC
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2982 # define stat _stat
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2983 # ifndef _INTPTR_T_DEFINED
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2984 # define intptr_t int
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2985 # endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2986 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2987
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2988 #ifndef DIR_SEPARATOR
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2989 # define DIR_SEPARATOR '/'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2990 # define PATH_SEPARATOR ':'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2991 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2992
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2993 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2994 defined (__OS2__)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2995 # define HAVE_DOS_BASED_FILE_SYSTEM
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2996 # define FOPEN_WB "wb"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2997 # ifndef DIR_SEPARATOR_2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2998 # define DIR_SEPARATOR_2 '\\'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2999 # endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3000 # ifndef PATH_SEPARATOR_2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3001 # define PATH_SEPARATOR_2 ';'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3002 # endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3003 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3004
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3005 #ifndef DIR_SEPARATOR_2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3006 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3007 #else /* DIR_SEPARATOR_2 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3008 # define IS_DIR_SEPARATOR(ch) \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3009 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3010 #endif /* DIR_SEPARATOR_2 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3011
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3012 #ifndef PATH_SEPARATOR_2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3013 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3014 #else /* PATH_SEPARATOR_2 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3015 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3016 #endif /* PATH_SEPARATOR_2 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3017
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3018 #ifdef __CYGWIN__
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3019 # define FOPEN_WB "wb"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3020 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3021
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3022 #ifndef FOPEN_WB
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3023 # define FOPEN_WB "w"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3024 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3025 #ifndef _O_BINARY
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3026 # define _O_BINARY 0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3027 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3028
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3029 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3030 #define XFREE(stale) do { \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3031 if (stale) { free ((void *) stale); stale = 0; } \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3032 } while (0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3033
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3034 #undef LTWRAPPER_DEBUGPRINTF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3035 #if defined DEBUGWRAPPER
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3036 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3037 static void
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3038 ltwrapper_debugprintf (const char *fmt, ...)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3039 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3040 va_list args;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3041 va_start (args, fmt);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3042 (void) vfprintf (stderr, fmt, args);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3043 va_end (args);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3044 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3045 #else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3046 # define LTWRAPPER_DEBUGPRINTF(args)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3047 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3048
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3049 const char *program_name = NULL;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3050
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3051 void *xmalloc (size_t num);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3052 char *xstrdup (const char *string);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3053 const char *base_name (const char *name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3054 char *find_executable (const char *wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3055 char *chase_symlinks (const char *pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3056 int make_executable (const char *path);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3057 int check_executable (const char *path);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3058 char *strendzap (char *str, const char *pat);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3059 void lt_fatal (const char *message, ...);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3060
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3061 static const char *script_text =
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3062 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3063
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3064 func_emit_wrapper yes |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3065 $SED -e 's/\([\\"]\)/\\\1/g' \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3066 -e 's/^/ "/' -e 's/$/\\n"/'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3067 echo ";"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3068
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3069 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3070 const char * MAGIC_EXE = "$magic_exe";
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3071
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3072 int
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3073 main (int argc, char *argv[])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3074 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3075 char **newargz;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3076 char *tmp_pathspec;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3077 char *actual_cwrapper_path;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3078 char *shwrapper_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3079 intptr_t rval = 127;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3080 FILE *shwrapper;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3081
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3082 const char *dumpscript_opt = "--lt-dump-script";
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3083 int i;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3084
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3085 program_name = (char *) xstrdup (base_name (argv[0]));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3086 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3087 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3088
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3089 /* very simple arg parsing; don't want to rely on getopt */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3090 for (i = 1; i < argc; i++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3091 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3092 if (strcmp (argv[i], dumpscript_opt) == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3093 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3094 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3095 case "$host" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3096 *mingw* | *cygwin* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3097 # make stdout use "unix" line endings
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3098 echo " setmode(1,_O_BINARY);"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3099 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3100 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3101
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3102 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3103 printf ("%s", script_text);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3104 return 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3105 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3106 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3107
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3108 newargz = XMALLOC (char *, argc + 2);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3109 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3110
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3111 if test -n "$TARGETSHELL" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3112 # no path translation at all
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3113 lt_newargv0=$TARGETSHELL
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3114 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3115 case "$host" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3116 *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3117 # awkward: cmd appends spaces to result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3118 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3119 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3120 case $lt_newargv0 in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3121 *.exe | *.EXE) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3122 *) lt_newargv0=$lt_newargv0.exe ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3123 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3124 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3125 * ) lt_newargv0=$SHELL ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3126 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3127 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3128
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3129 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3130 newargz[0] = (char *) xstrdup ("$lt_newargv0");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3131 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3132
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3133 cat <<"EOF"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3134 tmp_pathspec = find_executable (argv[0]);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3135 if (tmp_pathspec == NULL)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3136 lt_fatal ("Couldn't find %s", argv[0]);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3137 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3138 tmp_pathspec));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3139
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3140 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3141 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3142 actual_cwrapper_path));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3143 XFREE (tmp_pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3144
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3145 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3146 strendzap (actual_cwrapper_path, shwrapper_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3147
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3148 /* shwrapper_name transforms */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3149 strendzap (shwrapper_name, ".exe");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3150 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3151 strlen ("_ltshwrapperTMP") + 1));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3152 strcpy (tmp_pathspec, shwrapper_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3153 strcat (tmp_pathspec, "_ltshwrapperTMP");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3154 XFREE (shwrapper_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3155 shwrapper_name = tmp_pathspec;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3156 tmp_pathspec = 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3157 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3158 shwrapper_name));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3159 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3160
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3161 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3162 newargz[1] =
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3163 XMALLOC (char, (strlen (actual_cwrapper_path) +
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3164 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3165 strcpy (newargz[1], actual_cwrapper_path);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3166 strcat (newargz[1], "$objdir");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3167 strcat (newargz[1], "/");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3168 strcat (newargz[1], shwrapper_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3169 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3170
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3171
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3172 case $host_os in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3173 mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3174 cat <<"EOF"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3175 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3176 char* p;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3177 while ((p = strchr (newargz[1], '\\')) != NULL)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3178 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3179 *p = '/';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3180 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3181 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3182 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3183 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3184 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3185
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3186 cat <<"EOF"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3187 XFREE (shwrapper_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3188 XFREE (actual_cwrapper_path);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3189
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3190 /* always write in binary mode */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3191 if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3192 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3193 lt_fatal ("Could not open %s for writing", newargz[1]);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3194 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3195 fprintf (shwrapper, "%s", script_text);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3196 fclose (shwrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3197
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3198 make_executable (newargz[1]);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3199
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3200 for (i = 1; i < argc; i++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3201 newargz[i + 1] = xstrdup (argv[i]);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3202 newargz[argc + 1] = NULL;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3203
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3204 for (i = 0; i < argc + 1; i++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3205 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3206 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3207 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3208
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3209 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3210
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3211 case $host_os in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3212 mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3213 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3214 /* execv doesn't actually work on mingw as expected on unix */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3215 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3216 if (rval == -1)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3217 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3218 /* failed to start process */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3219 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3220 return 127;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3221 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3222 return rval;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3223 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3224 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3225 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3226 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3227 cat <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3228 execv ("$lt_newargv0", newargz);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3229 return rval; /* =127, but avoids unused variable warning */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3230 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3231 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3232 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3233 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3234
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3235 cat <<"EOF"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3236
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3237 void *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3238 xmalloc (size_t num)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3239 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3240 void *p = (void *) malloc (num);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3241 if (!p)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3242 lt_fatal ("Memory exhausted");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3243
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3244 return p;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3245 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3246
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3247 char *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3248 xstrdup (const char *string)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3249 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3250 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3251 string) : NULL;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3252 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3253
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3254 const char *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3255 base_name (const char *name)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3256 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3257 const char *base;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3258
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3259 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3260 /* Skip over the disk name in MSDOS pathnames. */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3261 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3262 name += 2;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3263 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3264
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3265 for (base = name; *name; name++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3266 if (IS_DIR_SEPARATOR (*name))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3267 base = name + 1;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3268 return base;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3269 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3270
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3271 int
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3272 check_executable (const char *path)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3273 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3274 struct stat st;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3275
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3276 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3277 path ? (*path ? path : "EMPTY!") : "NULL!"));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3278 if ((!path) || (!*path))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3279 return 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3280
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3281 if ((stat (path, &st) >= 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3282 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3283 return 1;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3284 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3285 return 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3286 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3287
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3288 int
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3289 make_executable (const char *path)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3290 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3291 int rval = 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3292 struct stat st;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3293
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3294 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3295 path ? (*path ? path : "EMPTY!") : "NULL!"));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3296 if ((!path) || (!*path))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3297 return 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3298
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3299 if (stat (path, &st) >= 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3300 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3301 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3302 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3303 return rval;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3304 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3305
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3306 /* Searches for the full path of the wrapper. Returns
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3307 newly allocated full path name if found, NULL otherwise
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3308 Does not chase symlinks, even on platforms that support them.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3309 */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3310 char *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3311 find_executable (const char *wrapper)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3312 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3313 int has_slash = 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3314 const char *p;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3315 const char *p_next;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3316 /* static buffer for getcwd */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3317 char tmp[LT_PATHMAX + 1];
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3318 int tmp_len;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3319 char *concat_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3320
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3321 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3322 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3323
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3324 if ((wrapper == NULL) || (*wrapper == '\0'))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3325 return NULL;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3326
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3327 /* Absolute path? */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3328 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3329 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3330 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3331 concat_name = xstrdup (wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3332 if (check_executable (concat_name))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3333 return concat_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3334 XFREE (concat_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3335 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3336 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3337 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3338 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3339 if (IS_DIR_SEPARATOR (wrapper[0]))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3340 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3341 concat_name = xstrdup (wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3342 if (check_executable (concat_name))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3343 return concat_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3344 XFREE (concat_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3345 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3346 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3347 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3348 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3349
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3350 for (p = wrapper; *p; p++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3351 if (*p == '/')
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3352 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3353 has_slash = 1;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3354 break;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3355 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3356 if (!has_slash)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3357 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3358 /* no slashes; search PATH */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3359 const char *path = getenv ("PATH");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3360 if (path != NULL)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3361 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3362 for (p = path; *p; p = p_next)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3363 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3364 const char *q;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3365 size_t p_len;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3366 for (q = p; *q; q++)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3367 if (IS_PATH_SEPARATOR (*q))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3368 break;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3369 p_len = q - p;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3370 p_next = (*q == '\0' ? q : q + 1);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3371 if (p_len == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3372 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3373 /* empty path: current directory */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3374 if (getcwd (tmp, LT_PATHMAX) == NULL)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3375 lt_fatal ("getcwd failed");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3376 tmp_len = strlen (tmp);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3377 concat_name =
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3378 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3379 memcpy (concat_name, tmp, tmp_len);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3380 concat_name[tmp_len] = '/';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3381 strcpy (concat_name + tmp_len + 1, wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3382 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3383 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3384 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3385 concat_name =
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3386 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3387 memcpy (concat_name, p, p_len);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3388 concat_name[p_len] = '/';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3389 strcpy (concat_name + p_len + 1, wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3390 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3391 if (check_executable (concat_name))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3392 return concat_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3393 XFREE (concat_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3394 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3395 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3396 /* not found in PATH; assume curdir */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3397 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3398 /* Relative path | not found in path: prepend cwd */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3399 if (getcwd (tmp, LT_PATHMAX) == NULL)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3400 lt_fatal ("getcwd failed");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3401 tmp_len = strlen (tmp);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3402 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3403 memcpy (concat_name, tmp, tmp_len);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3404 concat_name[tmp_len] = '/';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3405 strcpy (concat_name + tmp_len + 1, wrapper);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3406
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3407 if (check_executable (concat_name))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3408 return concat_name;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3409 XFREE (concat_name);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3410 return NULL;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3411 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3412
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3413 char *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3414 chase_symlinks (const char *pathspec)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3415 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3416 #ifndef S_ISLNK
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3417 return xstrdup (pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3418 #else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3419 char buf[LT_PATHMAX];
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3420 struct stat s;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3421 char *tmp_pathspec = xstrdup (pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3422 char *p;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3423 int has_symlinks = 0;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3424 while (strlen (tmp_pathspec) && !has_symlinks)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3425 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3426 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3427 tmp_pathspec));
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3428 if (lstat (tmp_pathspec, &s) == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3429 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3430 if (S_ISLNK (s.st_mode) != 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3431 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3432 has_symlinks = 1;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3433 break;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3434 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3435
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3436 /* search backwards for last DIR_SEPARATOR */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3437 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3438 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3439 p--;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3440 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3441 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3442 /* no more DIR_SEPARATORS left */
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3443 break;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3444 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3445 *p = '\0';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3446 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3447 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3448 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3449 char *errstr = strerror (errno);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3450 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3451 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3452 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3453 XFREE (tmp_pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3454
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3455 if (!has_symlinks)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3456 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3457 return xstrdup (pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3458 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3459
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3460 tmp_pathspec = realpath (pathspec, buf);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3461 if (tmp_pathspec == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3462 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3463 lt_fatal ("Could not follow symlinks for %s", pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3464 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3465 return xstrdup (tmp_pathspec);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3466 #endif
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3467 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3468
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3469 char *
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3470 strendzap (char *str, const char *pat)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3471 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3472 size_t len, patlen;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3473
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3474 assert (str != NULL);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3475 assert (pat != NULL);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3476
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3477 len = strlen (str);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3478 patlen = strlen (pat);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3479
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3480 if (patlen <= len)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3481 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3482 str += len - patlen;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3483 if (strcmp (str, pat) == 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3484 *str = '\0';
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3485 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3486 return str;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3487 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3488
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3489 static void
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3490 lt_error_core (int exit_status, const char *mode,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3491 const char *message, va_list ap)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3492 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3493 fprintf (stderr, "%s: %s: ", program_name, mode);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3494 vfprintf (stderr, message, ap);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3495 fprintf (stderr, ".\n");
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3496
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3497 if (exit_status >= 0)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3498 exit (exit_status);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3499 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3500
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3501 void
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3502 lt_fatal (const char *message, ...)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3503 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3504 va_list ap;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3505 va_start (ap, message);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3506 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3507 va_end (ap);
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3508 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3509 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3510 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3511 # end: func_emit_cwrapperexe_src
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3512
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3513 # func_mode_link arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3514 func_mode_link ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3515 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3516 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3517 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3519 # It is impossible to link a dll without this setting, and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3520 # we shouldn't force the makefile maintainer to figure out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3521 # which system we are compiling for in order to pass an extra
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3522 # flag for every libtool invocation.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3523 # allow_undefined=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3524
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3525 # FIXME: Unfortunately, there are problems with the above when trying
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3526 # to make a dll which has undefined symbols, in which case not
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3527 # even a static library is built. For now, we need to specify
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3528 # -no-undefined on the libtool link line when we can be certain
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3529 # that all symbols are satisfied, otherwise we get a static library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3530 allow_undefined=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3531 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3532 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3533 allow_undefined=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3534 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3535 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3536 libtool_args=$nonopt
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3537 base_compile="$nonopt $@"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3538 compile_command=$nonopt
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3539 finalize_command=$nonopt
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3540
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3541 compile_rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3542 finalize_rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3543 compile_shlibpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3544 finalize_shlibpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3545 convenience=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3546 old_convenience=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3547 deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3548 old_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3549 compiler_flags=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3550 linker_flags=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3551 dllsearchpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3552 lib_search_path=`pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3553 inst_prefix_dir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3554 new_inherited_linker_flags=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3555
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3556 avoid_version=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3557 dlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3558 dlprefiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3559 dlself=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3560 export_dynamic=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3561 export_symbols=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3562 export_symbols_regex=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3563 generated=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3564 libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3565 ltlibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3566 module=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3567 no_install=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3568 objs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3569 non_pic_objects=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3570 precious_files_regex=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3571 prefer_static_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3572 preload=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3573 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3574 prevarg=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3575 release=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3576 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3577 xrpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3578 perm_rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3579 temp_rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3580 thread_safe=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3581 vinfo=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3582 vinfo_number=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3583 weak_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3584 single_module="${wl}-single_module"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3585 func_infer_tag $base_compile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3586
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3587 # We need to know -static, to get the right output filenames.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3588 for arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3589 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3590 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3591 -shared)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3592 test "$build_libtool_libs" != yes && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3593 func_fatal_configuration "can not build a shared library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3594 build_old_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3595 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3596 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3597 -all-static | -static | -static-libtool-libs)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3598 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3599 -all-static)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3600 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3601 func_warning "complete static linking is impossible in this configuration"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3602 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3603 if test -n "$link_static_flag"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3604 dlopen_self=$dlopen_self_static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3605 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3606 prefer_static_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3607 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3608 -static)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3609 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3610 dlopen_self=$dlopen_self_static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3611 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3612 prefer_static_libs=built
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3613 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3614 -static-libtool-libs)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3615 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3616 dlopen_self=$dlopen_self_static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3617 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3618 prefer_static_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3619 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3620 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3621 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3622 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3623 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3624 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3625 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3626 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3627
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3628 # See if our shared archives depend on static archives.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3629 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3630
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3631 # Go through the arguments, transforming them on the way.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3632 while test "$#" -gt 0; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3633 arg="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3634 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3635 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3636 qarg=$func_quote_for_eval_unquoted_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3637 func_append libtool_args " $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3638
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3639 # If the previous option needs an argument, assign it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3640 if test -n "$prev"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3641 case $prev in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3642 output)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3643 func_append compile_command " @OUTPUT@"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3644 func_append finalize_command " @OUTPUT@"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3645 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3646 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3647
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3648 case $prev in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3649 dlfiles|dlprefiles)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3650 if test "$preload" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3651 # Add the symbol object into the linking commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3652 func_append compile_command " @SYMFILE@"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3653 func_append finalize_command " @SYMFILE@"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3654 preload=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3655 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3656 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3657 *.la | *.lo) ;; # We handle these cases below.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3658 force)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3659 if test "$dlself" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3660 dlself=needless
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3661 export_dynamic=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3662 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3663 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3664 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3665 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3666 self)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3667 if test "$prev" = dlprefiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3668 dlself=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3669 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3670 dlself=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3671 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3672 dlself=needless
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3673 export_dynamic=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3674 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3675 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3676 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3677 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3678 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3679 if test "$prev" = dlfiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3680 dlfiles="$dlfiles $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3681 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3682 dlprefiles="$dlprefiles $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3683 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3684 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3685 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3686 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3687 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3688 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3689 expsyms)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3690 export_symbols="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3691 test -f "$arg" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3692 || func_fatal_error "symbol file \`$arg' does not exist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3693 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3694 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3695 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3696 expsyms_regex)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3697 export_symbols_regex="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3698 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3699 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3700 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3701 framework)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3702 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3703 *-*-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3704 case "$deplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3705 *" $qarg.ltframework "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3706 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3707 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3708 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3709 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3710 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3711 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3712 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3713 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3714 inst_prefix)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3715 inst_prefix_dir="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3716 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3717 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3718 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3719 objectlist)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3720 if test -f "$arg"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3721 save_arg=$arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3722 moreargs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3723 for fil in `cat "$save_arg"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3724 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3725 # moreargs="$moreargs $fil"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3726 arg=$fil
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3727 # A libtool-controlled object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3728
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3729 # Check to see that this really is a libtool object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3730 if func_lalib_unsafe_p "$arg"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3731 pic_object=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3732 non_pic_object=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3733
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3734 # Read the .lo file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3735 func_source "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3736
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3737 if test -z "$pic_object" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3738 test -z "$non_pic_object" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3739 test "$pic_object" = none &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3740 test "$non_pic_object" = none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3741 func_fatal_error "cannot find name of object for \`$arg'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3742 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3743
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3744 # Extract subdirectory from the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3745 func_dirname "$arg" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3746 xdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3747
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3748 if test "$pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3749 # Prepend the subdirectory the object is found in.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3750 pic_object="$xdir$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3751
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3752 if test "$prev" = dlfiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3753 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3754 dlfiles="$dlfiles $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3755 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3756 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3757 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3758 # If libtool objects are unsupported, then we need to preload.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3759 prev=dlprefiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3760 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3761 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3762
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3763 # CHECK ME: I think I busted this. -Ossama
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3764 if test "$prev" = dlprefiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3765 # Preload the old-style object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3766 dlprefiles="$dlprefiles $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3767 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3768 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3769
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3770 # A PIC object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3771 func_append libobjs " $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3772 arg="$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3773 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3774
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3775 # Non-PIC object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3776 if test "$non_pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3777 # Prepend the subdirectory the object is found in.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3778 non_pic_object="$xdir$non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3779
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3780 # A standard non-PIC object
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3781 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3782 if test -z "$pic_object" || test "$pic_object" = none ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3783 arg="$non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3784 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3785 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3786 # If the PIC object exists, use it instead.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3787 # $xdir was prepended to $pic_object above.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3788 non_pic_object="$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3789 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3790 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3791 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3792 # Only an error if not doing a dry-run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3793 if $opt_dry_run; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3794 # Extract subdirectory from the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3795 func_dirname "$arg" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3796 xdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3797
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3798 func_lo2o "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3799 pic_object=$xdir$objdir/$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3800 non_pic_object=$xdir$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3801 func_append libobjs " $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3802 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3803 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3804 func_fatal_error "\`$arg' is not a valid libtool object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3805 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3806 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3807 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3808 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3809 func_fatal_error "link input file \`$arg' does not exist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3810 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3811 arg=$save_arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3812 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3813 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3814 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3815 precious_regex)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3816 precious_files_regex="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3817 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3818 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3819 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3820 release)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3821 release="-$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3822 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3823 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3824 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3825 rpath | xrpath)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3826 # We need an absolute path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3827 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3828 [\\/]* | [A-Za-z]:[\\/]*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3829 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3830 func_fatal_error "only absolute run-paths are allowed"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3831 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3832 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3833 if test "$prev" = rpath; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3834 case "$rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3835 *" $arg "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3836 *) rpath="$rpath $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3837 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3838 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3839 case "$xrpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3840 *" $arg "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3841 *) xrpath="$xrpath $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3842 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3843 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3844 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3845 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3846 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3847 shrext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3848 shrext_cmds="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3849 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3850 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3851 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3852 weak)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3853 weak_libs="$weak_libs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3854 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3855 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3856 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3857 xcclinker)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3858 linker_flags="$linker_flags $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3859 compiler_flags="$compiler_flags $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3860 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3861 func_append compile_command " $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3862 func_append finalize_command " $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3863 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3864 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3865 xcompiler)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3866 compiler_flags="$compiler_flags $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3867 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3868 func_append compile_command " $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3869 func_append finalize_command " $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3870 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3871 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3872 xlinker)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3873 linker_flags="$linker_flags $qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3874 compiler_flags="$compiler_flags $wl$qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3875 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3876 func_append compile_command " $wl$qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3877 func_append finalize_command " $wl$qarg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3878 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3879 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3880 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3881 eval "$prev=\"\$arg\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3882 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3883 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3884 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3885 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3886 fi # test -n "$prev"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3887
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3888 prevarg="$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3889
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3890 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3891 -all-static)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3892 if test -n "$link_static_flag"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3893 # See comment for -static flag below, for more details.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3894 func_append compile_command " $link_static_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3895 func_append finalize_command " $link_static_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3896 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3897 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3898 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3899
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3900 -allow-undefined)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3901 # FIXME: remove this flag sometime in the future.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3902 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3903 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3904
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3905 -avoid-version)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3906 avoid_version=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3907 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3908 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3909
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3910 -dlopen)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3911 prev=dlfiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3912 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3913 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3914
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3915 -dlpreopen)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3916 prev=dlprefiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3917 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3918 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3919
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3920 -export-dynamic)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3921 export_dynamic=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3922 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3923 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3924
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3925 -export-symbols | -export-symbols-regex)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3926 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3927 func_fatal_error "more than one -exported-symbols argument is not allowed"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3928 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3929 if test "X$arg" = "X-export-symbols"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3930 prev=expsyms
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3931 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3932 prev=expsyms_regex
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3933 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3934 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3935 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3936
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3937 -framework)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3938 prev=framework
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3939 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3940 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3941
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3942 -inst-prefix-dir)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3943 prev=inst_prefix
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3944 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3945 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3946
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3947 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3948 # so, if we see these flags be careful not to treat them like -L
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3949 -L[A-Z][A-Z]*:*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3950 case $with_gcc/$host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3951 no/*-*-irix* | /*-*-irix*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3952 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3953 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3954 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3955 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3956 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3957 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3958
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3959 -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3960 func_stripname '-L' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3961 dir=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3962 # We need an absolute path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3963 case $dir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3964 [\\/]* | [A-Za-z]:[\\/]*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3965 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3966 absdir=`cd "$dir" && pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3967 test -z "$absdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3968 func_fatal_error "cannot determine absolute directory name of \`$dir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3969 dir="$absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3970 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3971 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3972 case "$deplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3973 *" -L$dir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3974 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3975 deplibs="$deplibs -L$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3976 lib_search_path="$lib_search_path $dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3977 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3978 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3979 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3980 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3981 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3982 case :$dllsearchpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3983 *":$dir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3984 *) dllsearchpath="$dllsearchpath:$dir";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3985 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3986 case :$dllsearchpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3987 *":$testbindir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3988 *) dllsearchpath="$dllsearchpath:$testbindir";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3989 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3990 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3991 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3992 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3993 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3994
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3995 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3996 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3997 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3998 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3999 # These systems don't actually have a C or math library (as such)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4000 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4001 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4002 *-*-os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4003 # These systems don't actually have a C library (as such)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4004 test "X$arg" = "X-lc" && continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4005 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4006 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4007 # Do not include libc due to us having libc/libc_r.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4008 test "X$arg" = "X-lc" && continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4009 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4010 *-*-rhapsody* | *-*-darwin1.[012])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4011 # Rhapsody C and math libraries are in the System framework
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4012 deplibs="$deplibs System.ltframework"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4013 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4014 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4015 *-*-sco3.2v5* | *-*-sco5v6*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4016 # Causes problems with __ctype
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4017 test "X$arg" = "X-lc" && continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4018 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4019 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4020 # Compiler inserts libc in the correct place for threads to work
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4021 test "X$arg" = "X-lc" && continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4022 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4023 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4024 elif test "X$arg" = "X-lc_r"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4025 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4026 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4027 # Do not include libc_r directly, use -pthread flag.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4028 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4029 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4030 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4031 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4032 deplibs="$deplibs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4033 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4034 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4035
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4036 -module)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4037 module=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4038 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4039 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4040
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4041 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4042 # classes, name mangling, and exception handling.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4043 # Darwin uses the -arch flag to determine output architecture.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4044 -model|-arch|-isysroot)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4045 compiler_flags="$compiler_flags $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4046 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4047 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4048 prev=xcompiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4049 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4050 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4051
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4052 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4053 compiler_flags="$compiler_flags $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4054 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4055 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4056 case "$new_inherited_linker_flags " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4057 *" $arg "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4058 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4059 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4060 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4061 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4062
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4063 -multi_module)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4064 single_module="${wl}-multi_module"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4065 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4066 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4067
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4068 -no-fast-install)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4069 fast_install=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4070 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4071 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4072
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4073 -no-install)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4074 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4075 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4076 # The PATH hackery in wrapper scripts is required on Windows
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4077 # and Darwin in order for the loader to find any dlls it needs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4078 func_warning "\`-no-install' is ignored for $host"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4079 func_warning "assuming \`-no-fast-install' instead"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4080 fast_install=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4081 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4082 *) no_install=yes ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4083 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4084 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4085 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4086
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4087 -no-undefined)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4088 allow_undefined=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4089 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4090 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4091
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4092 -objectlist)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4093 prev=objectlist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4094 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4095 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4096
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4097 -o) prev=output ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4098
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4099 -precious-files-regex)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4100 prev=precious_regex
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4101 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4102 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4103
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4104 -release)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4105 prev=release
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4106 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4107 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4108
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4109 -rpath)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4110 prev=rpath
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4111 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4112 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4113
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4114 -R)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4115 prev=xrpath
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4116 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4117 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4118
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4119 -R*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4120 func_stripname '-R' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4121 dir=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4122 # We need an absolute path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4123 case $dir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4124 [\\/]* | [A-Za-z]:[\\/]*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4125 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4126 func_fatal_error "only absolute run-paths are allowed"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4127 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4128 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4129 case "$xrpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4130 *" $dir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4131 *) xrpath="$xrpath $dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4132 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4133 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4134 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4135
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4136 -shared)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4137 # The effects of -shared are defined in a previous loop.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4138 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4139 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4140
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4141 -shrext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4142 prev=shrext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4143 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4144 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4145
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4146 -static | -static-libtool-libs)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4147 # The effects of -static are defined in a previous loop.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4148 # We used to do the same as -all-static on platforms that
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4149 # didn't have a PIC flag, but the assumption that the effects
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4150 # would be equivalent was wrong. It would break on at least
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4151 # Digital Unix and AIX.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4152 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4153 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4154
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4155 -thread-safe)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4156 thread_safe=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4157 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4158 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4159
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4160 -version-info)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4161 prev=vinfo
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4162 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4163 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4164
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4165 -version-number)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4166 prev=vinfo
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4167 vinfo_number=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4168 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4169 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4170
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4171 -weak)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4172 prev=weak
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4173 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4174 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4175
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4176 -Wc,*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4177 func_stripname '-Wc,' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4178 args=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4179 arg=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4180 save_ifs="$IFS"; IFS=','
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4181 for flag in $args; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4182 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4183 func_quote_for_eval "$flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4184 arg="$arg $wl$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4185 compiler_flags="$compiler_flags $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4186 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4187 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4188 func_stripname ' ' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4189 arg=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4190 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4191
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4192 -Wl,*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4193 func_stripname '-Wl,' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4194 args=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4195 arg=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4196 save_ifs="$IFS"; IFS=','
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4197 for flag in $args; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4198 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4199 func_quote_for_eval "$flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4200 arg="$arg $wl$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4201 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4202 linker_flags="$linker_flags $func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4203 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4204 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4205 func_stripname ' ' '' "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4206 arg=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4207 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4208
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4209 -Xcompiler)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4210 prev=xcompiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4211 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4212 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4213
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4214 -Xlinker)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4215 prev=xlinker
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4216 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4217 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4218
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4219 -XCClinker)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4220 prev=xcclinker
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4221 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4222 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4223
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4224 # -msg_* for osf cc
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4225 -msg_*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4226 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4227 arg="$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4228 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4229
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4230 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4231 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4232 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4233 # +DA*, +DD* enable 64-bit mode on the HP compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4234 # -q* pass through compiler args for the IBM compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4235 # -m*, -t[45]*, -txscale* pass through architecture-specific
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4236 # compiler args for GCC
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4237 # -F/path gives path to uninstalled frameworks, gcc on darwin
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4238 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4239 # @file GCC response files
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4240 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4241 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4242 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4243 arg="$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4244 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4245 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4246 compiler_flags="$compiler_flags $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4247 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4248 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4249
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4250 # Some other compiler flag.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4251 -* | +*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4252 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4253 arg="$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4254 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4255
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4256 *.$objext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4257 # A standard object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4258 objs="$objs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4259 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4260
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4261 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4262 # A libtool-controlled object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4263
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4264 # Check to see that this really is a libtool object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4265 if func_lalib_unsafe_p "$arg"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4266 pic_object=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4267 non_pic_object=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4268
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4269 # Read the .lo file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4270 func_source "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4271
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4272 if test -z "$pic_object" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4273 test -z "$non_pic_object" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4274 test "$pic_object" = none &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4275 test "$non_pic_object" = none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4276 func_fatal_error "cannot find name of object for \`$arg'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4277 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4278
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4279 # Extract subdirectory from the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4280 func_dirname "$arg" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4281 xdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4282
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4283 if test "$pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4284 # Prepend the subdirectory the object is found in.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4285 pic_object="$xdir$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4286
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4287 if test "$prev" = dlfiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4288 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4289 dlfiles="$dlfiles $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4290 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4291 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4292 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4293 # If libtool objects are unsupported, then we need to preload.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4294 prev=dlprefiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4295 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4296 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4297
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4298 # CHECK ME: I think I busted this. -Ossama
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4299 if test "$prev" = dlprefiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4300 # Preload the old-style object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4301 dlprefiles="$dlprefiles $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4302 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4303 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4304
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4305 # A PIC object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4306 func_append libobjs " $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4307 arg="$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4308 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4309
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4310 # Non-PIC object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4311 if test "$non_pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4312 # Prepend the subdirectory the object is found in.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4313 non_pic_object="$xdir$non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4314
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4315 # A standard non-PIC object
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4316 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4317 if test -z "$pic_object" || test "$pic_object" = none ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4318 arg="$non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4319 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4320 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4321 # If the PIC object exists, use it instead.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4322 # $xdir was prepended to $pic_object above.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4323 non_pic_object="$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4324 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4325 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4326 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4327 # Only an error if not doing a dry-run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4328 if $opt_dry_run; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4329 # Extract subdirectory from the argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4330 func_dirname "$arg" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4331 xdir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4332
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4333 func_lo2o "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4334 pic_object=$xdir$objdir/$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4335 non_pic_object=$xdir$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4336 func_append libobjs " $pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4337 func_append non_pic_objects " $non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4338 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4339 func_fatal_error "\`$arg' is not a valid libtool object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4340 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4341 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4342 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4343
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4344 *.$libext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4345 # An archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4346 deplibs="$deplibs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4347 old_deplibs="$old_deplibs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4348 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4349 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4350
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4351 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4352 # A libtool-controlled library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4353
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4354 if test "$prev" = dlfiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4355 # This library was specified with -dlopen.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4356 dlfiles="$dlfiles $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4357 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4358 elif test "$prev" = dlprefiles; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4359 # The library was specified with -dlpreopen.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4360 dlprefiles="$dlprefiles $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4361 prev=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4362 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4363 deplibs="$deplibs $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4364 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4365 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4366 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4367
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4368 # Some other compiler argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4369 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4370 # Unknown arguments in both finalize_command and compile_command need
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4371 # to be aesthetically quoted because they are evaled later.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4372 func_quote_for_eval "$arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4373 arg="$func_quote_for_eval_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4374 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4375 esac # arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4376
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4377 # Now actually substitute the argument into the commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4378 if test -n "$arg"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4379 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4380 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4381 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4382 done # argument parsing loop
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4383
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4384 test -n "$prev" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4385 func_fatal_help "the \`$prevarg' option requires an argument"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4386
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4387 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4388 eval arg=\"$export_dynamic_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4389 func_append compile_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4390 func_append finalize_command " $arg"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4391 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4392
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4393 oldlibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4394 # calculate the name of the file, without its directory
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4395 func_basename "$output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4396 outputname="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4397 libobjs_save="$libobjs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4398
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4399 if test -n "$shlibpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4400 # get the directories listed in $shlibpath_var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4401 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4402 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4403 shlib_search_path=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4404 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4405 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4406 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4407
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4408 func_dirname "$output" "/" ""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4409 output_objdir="$func_dirname_result$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4410 # Create the object directory.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4411 func_mkdir_p "$output_objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4412
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4413 # Determine the type of output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4414 case $output in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4415 "")
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4416 func_fatal_help "you must specify an output file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4417 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4418 *.$libext) linkmode=oldlib ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4419 *.lo | *.$objext) linkmode=obj ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4420 *.la) linkmode=lib ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4421 *) linkmode=prog ;; # Anything else should be a program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4422 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4423
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4424 specialdeplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4425
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4426 libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4427 # Find all interdependent deplibs by searching for libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4428 # that are linked more than once (e.g. -la -lb -la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4429 for deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4430 if $opt_duplicate_deps ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4431 case "$libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4432 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4433 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4434 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4435 libs="$libs $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4436 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4437
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4438 if test "$linkmode" = lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4439 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4440
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4441 # Compute libraries that are listed more than once in $predeps
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4442 # $postdeps and mark them as special (i.e., whose duplicates are
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4443 # not to be eliminated).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4444 pre_post_deps=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4445 if $opt_duplicate_compiler_generated_deps; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4446 for pre_post_dep in $predeps $postdeps; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4447 case "$pre_post_deps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4448 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4449 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4450 pre_post_deps="$pre_post_deps $pre_post_dep"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4451 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4452 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4453 pre_post_deps=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4454 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4455
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4456 deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4457 newdependency_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4458 newlib_search_path=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4459 need_relink=no # whether we're linking any uninstalled libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4460 notinst_deplibs= # not-installed libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4461 notinst_path= # paths that contain not-installed libtool libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4462
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4463 case $linkmode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4464 lib)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4465 passes="conv dlpreopen link"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4466 for file in $dlfiles $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4467 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4468 *.la) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4469 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4470 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4471 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4472 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4473 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4474 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4475 prog)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4476 compile_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4477 finalize_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4478 alldeplibs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4479 newdlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4480 newdlprefiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4481 passes="conv scan dlopen dlpreopen link"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4482 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4483 *) passes="conv"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4484 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4485 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4486
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4487 for pass in $passes; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4488 # The preopen pass in lib mode reverses $deplibs; put it back here
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4489 # so that -L comes before libs that need it for instance...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4490 if test "$linkmode,$pass" = "lib,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4491 ## FIXME: Find the place where the list is rebuilt in the wrong
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4492 ## order, and fix it there properly
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4493 tmp_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4494 for deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4495 tmp_deplibs="$deplib $tmp_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4496 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4497 deplibs="$tmp_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4498 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4499
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4500 if test "$linkmode,$pass" = "lib,link" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4501 test "$linkmode,$pass" = "prog,scan"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4502 libs="$deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4503 deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4504 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4505 if test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4506 case $pass in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4507 dlopen) libs="$dlfiles" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4508 dlpreopen) libs="$dlprefiles" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4509 link)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4510 libs="$deplibs %DEPLIBS%"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4511 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4512 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4513 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4514 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4515 if test "$linkmode,$pass" = "lib,dlpreopen"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4516 # Collect and forward deplibs of preopened libtool libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4517 for lib in $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4518 # Ignore non-libtool-libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4519 dependency_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4520 case $lib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4521 *.la) func_source "$lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4522 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4523
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4524 # Collect preopened libtool deplibs, except any this library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4525 # has declared as weak libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4526 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4527 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4528 case " $weak_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4529 *" $deplib_base "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4530 *) deplibs="$deplibs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4531 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4532 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4533 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4534 libs="$dlprefiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4535 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4536 if test "$pass" = dlopen; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4537 # Collect dlpreopened libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4538 save_deplibs="$deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4539 deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4540 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4541
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4542 for deplib in $libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4543 lib=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4544 found=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4545 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4546 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4547 if test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4548 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4549 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4550 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4551 compiler_flags="$compiler_flags $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4552 if test "$linkmode" = lib ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4553 case "$new_inherited_linker_flags " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4554 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4555 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4556 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4557 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4558 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4559 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4560 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4561 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4562 if test "$linkmode" != lib && test "$linkmode" != prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4563 func_warning "\`-l' is ignored for archives/objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4564 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4565 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4566 func_stripname '-l' '' "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4567 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4568 if test "$linkmode" = lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4569 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4570 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4571 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4572 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4573 for searchdir in $searchdirs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4574 for search_ext in .la $std_shrext .so .a; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4575 # Search the libtool library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4576 lib="$searchdir/lib${name}${search_ext}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4577 if test -f "$lib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4578 if test "$search_ext" = ".la"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4579 found=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4580 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4581 found=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4582 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4583 break 2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4584 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4585 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4586 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4587 if test "$found" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4588 # deplib doesn't seem to be a libtool library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4589 if test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4590 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4591 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4592 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4593 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4594 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4595 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4596 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4597 else # deplib is a libtool library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4598 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4599 # We need to do some special things here, and not later.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4600 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4601 case " $predeps $postdeps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4602 *" $deplib "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4603 if func_lalib_p "$lib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4604 library_names=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4605 old_library=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4606 func_source "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4607 for l in $old_library $library_names; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4608 ll="$l"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4609 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4610 if test "X$ll" = "X$old_library" ; then # only static version available
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4611 found=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4612 func_dirname "$lib" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4613 ladir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4614 lib=$ladir/$old_library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4615 if test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4616 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4617 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4618 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4619 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4620 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4621 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4622 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4623 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4624 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4625 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4626 *) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4627 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4628 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4629 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4630 ;; # -l
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4631 *.ltframework)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4632 if test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4633 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4634 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4635 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4636 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4637 if test "$linkmode" = lib ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4638 case "$new_inherited_linker_flags " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4639 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4640 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4641 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4642 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4643 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4644 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4645 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4646 -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4647 case $linkmode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4648 lib)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4649 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4650 test "$pass" = conv && continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4651 newdependency_libs="$deplib $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4652 func_stripname '-L' '' "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4653 newlib_search_path="$newlib_search_path $func_stripname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4654 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4655 prog)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4656 if test "$pass" = conv; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4657 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4658 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4659 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4660 if test "$pass" = scan; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4661 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4662 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4663 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4664 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4665 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4666 func_stripname '-L' '' "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4667 newlib_search_path="$newlib_search_path $func_stripname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4668 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4669 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4670 func_warning "\`-L' is ignored for archives/objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4671 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4672 esac # linkmode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4673 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4674 ;; # -L
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4675 -R*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4676 if test "$pass" = link; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4677 func_stripname '-R' '' "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4678 dir=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4679 # Make sure the xrpath contains only unique directories.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4680 case "$xrpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4681 *" $dir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4682 *) xrpath="$xrpath $dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4683 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4684 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4685 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4686 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4687 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4688 *.la) lib="$deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4689 *.$libext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4690 if test "$pass" = conv; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4691 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4692 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4693 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4694 case $linkmode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4695 lib)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4696 # Linking convenience modules into shared libraries is allowed,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4697 # but linking other static libraries is non-portable.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4698 case " $dlpreconveniencelibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4699 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4700 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4701 valid_a_lib=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4702 case $deplibs_check_method in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4703 match_pattern*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4704 set dummy $deplibs_check_method; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4705 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4706 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4707 | $EGREP "$match_pattern_regex" > /dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4708 valid_a_lib=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4709 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4710 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4711 pass_all)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4712 valid_a_lib=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4713 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4714 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4715 if test "$valid_a_lib" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4716 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4717 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4718 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4719 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4720 $ECHO "*** shared version of the library, which you do not appear to have"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4721 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4722 $ECHO "*** that it is just a static archive that I should not use here."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4723 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4724 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4725 $ECHO "*** Warning: Linking the shared library $output against the"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4726 $ECHO "*** static library $deplib is not portable!"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4727 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4728 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4729 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4730 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4731 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4732 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4733 prog)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4734 if test "$pass" != link; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4735 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4736 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4737 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4738 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4739 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4740 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4741 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4742 esac # linkmode
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4743 ;; # *.$libext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4744 *.lo | *.$objext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4745 if test "$pass" = conv; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4746 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4747 elif test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4748 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4749 # If there is no dlopen support or we're linking statically,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4750 # we need to preload.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4751 newdlprefiles="$newdlprefiles $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4752 compile_deplibs="$deplib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4753 finalize_deplibs="$deplib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4754 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4755 newdlfiles="$newdlfiles $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4756 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4757 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4758 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4759 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4760 %DEPLIBS%)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4761 alldeplibs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4762 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4763 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4764 esac # case $deplib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4765
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4766 if test "$found" = yes || test -f "$lib"; then :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4767 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4768 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4769 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4770
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4771 # Check to see that this really is a libtool archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4772 func_lalib_unsafe_p "$lib" \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4773 || func_fatal_error "\`$lib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4774
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4775 func_dirname "$lib" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4776 ladir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4777
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4778 dlname=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4779 dlopen=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4780 dlpreopen=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4781 libdir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4782 library_names=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4783 old_library=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4784 inherited_linker_flags=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4785 # If the library was installed with an old release of libtool,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4786 # it will not redefine variables installed, or shouldnotlink
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4787 installed=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4788 shouldnotlink=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4789 avoidtemprpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4790
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4791
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4792 # Read the .la file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4793 func_source "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4794
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4795 # Convert "-framework foo" to "foo.ltframework"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4796 if test -n "$inherited_linker_flags"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4797 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4798 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4799 case " $new_inherited_linker_flags " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4800 *" $tmp_inherited_linker_flag "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4801 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4802 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4803 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4804 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4805 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4806 if test "$linkmode,$pass" = "lib,link" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4807 test "$linkmode,$pass" = "prog,scan" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4808 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4809 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4810 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4811 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4812
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4813 if test "$pass" = conv; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4814 # Only check for convenience libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4815 deplibs="$lib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4816 if test -z "$libdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4817 if test -z "$old_library"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4818 func_fatal_error "cannot find name of link library for \`$lib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4819 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4820 # It is a libtool convenience library, so add in its objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4821 convenience="$convenience $ladir/$objdir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4822 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4823 elif test "$linkmode" != prog && test "$linkmode" != lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4824 func_fatal_error "\`$lib' is not a convenience library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4825 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4826 tmp_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4827 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4828 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4829 if $opt_duplicate_deps ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4830 case "$tmp_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4831 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4832 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4833 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4834 tmp_libs="$tmp_libs $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4835 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4836 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4837 fi # $pass = conv
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4838
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4839
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4840 # Get the name of the library we link against.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4841 linklib=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4842 for l in $old_library $library_names; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4843 linklib="$l"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4844 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4845 if test -z "$linklib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4846 func_fatal_error "cannot find name of link library for \`$lib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4847 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4848
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4849 # This library was specified with -dlopen.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4850 if test "$pass" = dlopen; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4851 if test -z "$libdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4852 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4853 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4854 if test -z "$dlname" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4855 test "$dlopen_support" != yes ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4856 test "$build_libtool_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4857 # If there is no dlname, no dlopen support or we're linking
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4858 # statically, we need to preload. We also need to preload any
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4859 # dependent libraries so libltdl's deplib preloader doesn't
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4860 # bomb out in the load deplibs phase.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4861 dlprefiles="$dlprefiles $lib $dependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4862 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4863 newdlfiles="$newdlfiles $lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4864 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4865 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4866 fi # $pass = dlopen
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4867
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4868 # We need an absolute path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4869 case $ladir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4870 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4871 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4872 abs_ladir=`cd "$ladir" && pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4873 if test -z "$abs_ladir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4874 func_warning "cannot determine absolute directory name of \`$ladir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4875 func_warning "passing it literally to the linker, although it might fail"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4876 abs_ladir="$ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4877 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4878 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4879 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4880 func_basename "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4881 laname="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4882
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4883 # Find the relevant object directory and library name.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4884 if test "X$installed" = Xyes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4885 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4886 func_warning "library \`$lib' was moved."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4887 dir="$ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4888 absdir="$abs_ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4889 libdir="$abs_ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4890 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4891 dir="$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4892 absdir="$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4893 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4894 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4895 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4896 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4897 dir="$ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4898 absdir="$abs_ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4899 # Remove this search path later
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4900 notinst_path="$notinst_path $abs_ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4901 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4902 dir="$ladir/$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4903 absdir="$abs_ladir/$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4904 # Remove this search path later
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4905 notinst_path="$notinst_path $abs_ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4906 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4907 fi # $installed = yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4908 func_stripname 'lib' '.la' "$laname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4909 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4910
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4911 # This library was specified with -dlpreopen.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4912 if test "$pass" = dlpreopen; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4913 if test -z "$libdir" && test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4914 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4915 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4916 # Prefer using a static library (so that no silly _DYNAMIC symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4917 # are required to link).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4918 if test -n "$old_library"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4919 newdlprefiles="$newdlprefiles $dir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4920 # Keep a list of preopened convenience libraries to check
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4921 # that they are being used correctly in the link pass.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4922 test -z "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4923 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4924 # Otherwise, use the dlname, so that lt_dlopen finds it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4925 elif test -n "$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4926 newdlprefiles="$newdlprefiles $dir/$dlname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4927 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4928 newdlprefiles="$newdlprefiles $dir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4929 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4930 fi # $pass = dlpreopen
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4931
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4932 if test -z "$libdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4933 # Link the convenience library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4934 if test "$linkmode" = lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4935 deplibs="$dir/$old_library $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4936 elif test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4937 compile_deplibs="$dir/$old_library $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4938 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4939 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4940 deplibs="$lib $deplibs" # used for prog,scan pass
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4941 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4942 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4943 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4944
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4945
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4946 if test "$linkmode" = prog && test "$pass" != link; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4947 newlib_search_path="$newlib_search_path $ladir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4948 deplibs="$lib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4949
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4950 linkalldeplibs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4951 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4952 test "$build_libtool_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4953 linkalldeplibs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4954 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4955
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4956 tmp_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4957 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4958 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4959 -L*) func_stripname '-L' '' "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4960 newlib_search_path="$newlib_search_path $func_stripname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4961 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4962 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4963 # Need to link against all dependency_libs?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4964 if test "$linkalldeplibs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4965 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4966 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4967 # Need to hardcode shared library paths
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4968 # or/and link against static libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4969 newdependency_libs="$deplib $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4970 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4971 if $opt_duplicate_deps ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4972 case "$tmp_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4973 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4974 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4975 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4976 tmp_libs="$tmp_libs $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4977 done # for deplib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4978 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4979 fi # $linkmode = prog...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4980
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4981 if test "$linkmode,$pass" = "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4982 if test -n "$library_names" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4983 { { test "$prefer_static_libs" = no ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4984 test "$prefer_static_libs,$installed" = "built,yes"; } ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4985 test -z "$old_library"; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4986 # We need to hardcode the library path
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4987 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4988 # Make sure the rpath contains only unique directories.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4989 case "$temp_rpath:" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4990 *"$absdir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4991 *) temp_rpath="$temp_rpath$absdir:" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4992 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4993 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4994
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4995 # Hardcode the library path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4996 # Skip directories that are in the system default run-time
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4997 # search path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4998 case " $sys_lib_dlsearch_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4999 *" $absdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5000 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5001 case "$compile_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5002 *" $absdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5003 *) compile_rpath="$compile_rpath $absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5004 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5005 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5006 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5007 case " $sys_lib_dlsearch_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5008 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5009 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5010 case "$finalize_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5011 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5012 *) finalize_rpath="$finalize_rpath $libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5013 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5014 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5015 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5016 fi # $linkmode,$pass = prog,link...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5017
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5018 if test "$alldeplibs" = yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5019 { test "$deplibs_check_method" = pass_all ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5020 { test "$build_libtool_libs" = yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5021 test -n "$library_names"; }; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5022 # We only need to search for static libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5023 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5024 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5025 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5026
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5027 link_static=no # Whether the deplib will be linked statically
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5028 use_static_libs=$prefer_static_libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5029 if test "$use_static_libs" = built && test "$installed" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5030 use_static_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5031 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5032 if test -n "$library_names" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5033 { test "$use_static_libs" = no || test -z "$old_library"; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5034 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5035 *cygwin* | *mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5036 # No point in relinking DLLs because paths are not encoded
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5037 notinst_deplibs="$notinst_deplibs $lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5038 need_relink=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5039 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5040 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5041 if test "$installed" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5042 notinst_deplibs="$notinst_deplibs $lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5043 need_relink=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5044 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5045 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5046 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5047 # This is a shared library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5048
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5049 # Warn about portability, can't link against -module's on some
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5050 # systems (darwin). Don't bleat about dlopened modules though!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5051 dlopenmodule=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5052 for dlpremoduletest in $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5053 if test "X$dlpremoduletest" = "X$lib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5054 dlopenmodule="$dlpremoduletest"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5055 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5056 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5057 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5058 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5059 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5060 if test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5061 $ECHO "*** Warning: Linking the executable $output against the loadable module"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5062 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5063 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5064 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5065 $ECHO "*** $linklib is not portable!"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5066 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5067 if test "$linkmode" = lib &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5068 test "$hardcode_into_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5069 # Hardcode the library path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5070 # Skip directories that are in the system default run-time
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5071 # search path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5072 case " $sys_lib_dlsearch_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5073 *" $absdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5074 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5075 case "$compile_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5076 *" $absdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5077 *) compile_rpath="$compile_rpath $absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5078 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5079 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5080 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5081 case " $sys_lib_dlsearch_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5082 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5083 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5084 case "$finalize_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5085 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5086 *) finalize_rpath="$finalize_rpath $libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5087 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5088 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5089 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5090 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5091
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5092 if test -n "$old_archive_from_expsyms_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5093 # figure out the soname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5094 set dummy $library_names
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5095 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5096 realname="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5097 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5098 libname=`eval "\\$ECHO \"$libname_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5099 # use dlname if we got it. it's perfectly good, no?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5100 if test -n "$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5101 soname="$dlname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5102 elif test -n "$soname_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5103 # bleh windows
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5104 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5105 *cygwin* | mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5106 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5107 major=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5108 versuffix="-$major"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5109 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5110 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5111 eval soname=\"$soname_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5112 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5113 soname="$realname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5114 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5115
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5116 # Make a new name for the extract_expsyms_cmds to use
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5117 soroot="$soname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5118 func_basename "$soroot"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5119 soname="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5120 func_stripname 'lib' '.dll' "$soname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5121 newlib=libimp-$func_stripname_result.a
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5122
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5123 # If the library has no export list, then create one now
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5124 if test -f "$output_objdir/$soname-def"; then :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5125 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5126 func_verbose "extracting exported symbol list from \`$soname'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5127 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5128 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5129
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5130 # Create $newlib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5131 if test -f "$output_objdir/$newlib"; then :; else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5132 func_verbose "generating import library for \`$soname'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5133 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5134 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5135 # make sure the library variables are pointing to the new library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5136 dir=$output_objdir
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5137 linklib=$newlib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5138 fi # test -n "$old_archive_from_expsyms_cmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5139
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5140 if test "$linkmode" = prog || test "$mode" != relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5141 add_shlibpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5142 add_dir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5143 add=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5144 lib_linked=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5145 case $hardcode_action in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5146 immediate | unsupported)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5147 if test "$hardcode_direct" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5148 add="$dir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5149 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5150 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5151 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5152 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5153 *-*-unixware7*) add_dir="-L$dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5154 *-*-darwin* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5155 # if the lib is a (non-dlopened) module then we can not
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5156 # link against it, someone is ignoring the earlier warnings
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5157 if /usr/bin/file -L $add 2> /dev/null |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5158 $GREP ": [^:]* bundle" >/dev/null ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5159 if test "X$dlopenmodule" != "X$lib"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5160 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5161 if test -z "$old_library" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5162 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5163 $ECHO "*** And there doesn't seem to be a static archive available"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5164 $ECHO "*** The link will probably fail, sorry"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5165 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5166 add="$dir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5167 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5168 elif test -n "$old_library"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5169 add="$dir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5170 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5171 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5172 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5173 elif test "$hardcode_minus_L" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5174 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5175 *-*-sunos*) add_shlibpath="$dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5176 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5177 add_dir="-L$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5178 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5179 elif test "$hardcode_shlibpath_var" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5180 add_shlibpath="$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5181 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5182 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5183 lib_linked=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5184 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5185 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5186 relink)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5187 if test "$hardcode_direct" = yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5188 test "$hardcode_direct_absolute" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5189 add="$dir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5190 elif test "$hardcode_minus_L" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5191 add_dir="-L$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5192 # Try looking first in the location we're being installed to.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5193 if test -n "$inst_prefix_dir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5194 case $libdir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5195 [\\/]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5196 add_dir="$add_dir -L$inst_prefix_dir$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5197 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5198 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5199 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5200 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5201 elif test "$hardcode_shlibpath_var" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5202 add_shlibpath="$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5203 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5204 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5205 lib_linked=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5206 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5207 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5208 *) lib_linked=no ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5209 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5210
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5211 if test "$lib_linked" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5212 func_fatal_configuration "unsupported hardcode properties"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5213 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5214
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5215 if test -n "$add_shlibpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5216 case :$compile_shlibpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5217 *":$add_shlibpath:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5218 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5219 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5220 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5221 if test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5222 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5223 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5224 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5225 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5226 test -n "$add" && deplibs="$add $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5227 if test "$hardcode_direct" != yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5228 test "$hardcode_minus_L" != yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5229 test "$hardcode_shlibpath_var" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5230 case :$finalize_shlibpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5231 *":$libdir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5232 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5233 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5234 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5235 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5236 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5237
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5238 if test "$linkmode" = prog || test "$mode" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5239 add_shlibpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5240 add_dir=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5241 add=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5242 # Finalize command for both is simple: just hardcode it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5243 if test "$hardcode_direct" = yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5244 test "$hardcode_direct_absolute" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5245 add="$libdir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5246 elif test "$hardcode_minus_L" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5247 add_dir="-L$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5248 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5249 elif test "$hardcode_shlibpath_var" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5250 case :$finalize_shlibpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5251 *":$libdir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5252 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5253 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5254 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5255 elif test "$hardcode_automatic" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5256 if test -n "$inst_prefix_dir" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5257 test -f "$inst_prefix_dir$libdir/$linklib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5258 add="$inst_prefix_dir$libdir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5259 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5260 add="$libdir/$linklib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5261 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5262 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5263 # We cannot seem to hardcode it, guess we'll fake it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5264 add_dir="-L$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5265 # Try looking first in the location we're being installed to.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5266 if test -n "$inst_prefix_dir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5267 case $libdir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5268 [\\/]*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5269 add_dir="$add_dir -L$inst_prefix_dir$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5270 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5271 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5272 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5273 add="-l$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5274 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5275
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5276 if test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5277 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5278 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5279 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5280 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5281 test -n "$add" && deplibs="$add $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5282 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5283 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5284 elif test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5285 # Here we assume that one of hardcode_direct or hardcode_minus_L
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5286 # is not unsupported. This is valid on all known static and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5287 # shared platforms.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5288 if test "$hardcode_direct" != unsupported; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5289 test -n "$old_library" && linklib="$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5290 compile_deplibs="$dir/$linklib $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5291 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5292 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5293 compile_deplibs="-l$name -L$dir $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5294 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5295 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5296 elif test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5297 # Not a shared library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5298 if test "$deplibs_check_method" != pass_all; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5299 # We're trying link a shared library against a static one
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5300 # but the system doesn't support it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5301
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5302 # Just print a warning and add the library to dependency_libs so
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5303 # that the program can be linked against the static library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5304 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5305 $ECHO "*** Warning: This system can not link to static lib archive $lib."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5306 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5307 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5308 $ECHO "*** shared version of the library, which you do not appear to have."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5309 if test "$module" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5310 $ECHO "*** But as you try to build a module library, libtool will still create "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5311 $ECHO "*** a static module, that should work as long as the dlopening application"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5312 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5313 if test -z "$global_symbol_pipe"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5314 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5315 $ECHO "*** However, this would only work if libtool was able to extract symbol"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5316 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5317 $ECHO "*** not find such a program. So, this module is probably useless."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5318 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5319 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5320 if test "$build_old_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5321 build_libtool_libs=module
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5322 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5323 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5324 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5325 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5326 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5327 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5328 deplibs="$dir/$old_library $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5329 link_static=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5330 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5331 fi # link shared/static library?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5332
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5333 if test "$linkmode" = lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5334 if test -n "$dependency_libs" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5335 { test "$hardcode_into_libs" != yes ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5336 test "$build_old_libs" = yes ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5337 test "$link_static" = yes; }; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5338 # Extract -R from dependency_libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5339 temp_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5340 for libdir in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5341 case $libdir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5342 -R*) func_stripname '-R' '' "$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5343 temp_xrpath=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5344 case " $xrpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5345 *" $temp_xrpath "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5346 *) xrpath="$xrpath $temp_xrpath";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5347 esac;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5348 *) temp_deplibs="$temp_deplibs $libdir";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5349 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5350 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5351 dependency_libs="$temp_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5352 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5353
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5354 newlib_search_path="$newlib_search_path $absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5355 # Link against this library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5356 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5357 # ... and its dependency_libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5358 tmp_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5359 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5360 newdependency_libs="$deplib $newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5361 if $opt_duplicate_deps ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5362 case "$tmp_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5363 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5364 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5365 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5366 tmp_libs="$tmp_libs $deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5367 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5368
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5369 if test "$link_all_deplibs" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5370 # Add the search paths of all dependency libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5371 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5372 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5373 -L*) path="$deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5374 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5375 func_dirname "$deplib" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5376 dir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5377 # We need an absolute path.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5378 case $dir in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5379 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5380 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5381 absdir=`cd "$dir" && pwd`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5382 if test -z "$absdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5383 func_warning "cannot determine absolute directory name of \`$dir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5384 absdir="$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5385 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5386 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5387 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5388 if $GREP "^installed=no" $deplib > /dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5389 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5390 *-*-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5391 depdepl=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5392 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5393 if test -n "$deplibrary_names" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5394 for tmp in $deplibrary_names ; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5395 depdepl=$tmp
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5396 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5397 if test -f "$absdir/$objdir/$depdepl" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5398 depdepl="$absdir/$objdir/$depdepl"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5399 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5400 if test -z "$darwin_install_name"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5401 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5402 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5403 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5404 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5405 path=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5406 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5407 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5408 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5409 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5410 path="-L$absdir/$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5411 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5412 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5413 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5414 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5415 test -z "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5416 func_fatal_error "\`$deplib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5417 test "$absdir" != "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5418 func_warning "\`$deplib' seems to be moved"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5419
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5420 path="-L$absdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5421 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5422 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5423 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5424 case " $deplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5425 *" $path "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5426 *) deplibs="$path $deplibs" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5427 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5428 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5429 fi # link_all_deplibs != no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5430 fi # linkmode = lib
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5431 done # for deplib in $libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5432 if test "$pass" = link; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5433 if test "$linkmode" = "prog"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5434 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5435 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5436 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5437 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5438 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5439 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5440 dependency_libs="$newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5441 if test "$pass" = dlpreopen; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5442 # Link the dlpreopened libraries before other libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5443 for deplib in $save_deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5444 deplibs="$deplib $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5445 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5446 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5447 if test "$pass" != dlopen; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5448 if test "$pass" != conv; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5449 # Make sure lib_search_path contains only unique directories.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5450 lib_search_path=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5451 for dir in $newlib_search_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5452 case "$lib_search_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5453 *" $dir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5454 *) lib_search_path="$lib_search_path $dir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5455 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5456 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5457 newlib_search_path=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5458 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5459
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5460 if test "$linkmode,$pass" != "prog,link"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5461 vars="deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5462 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5463 vars="compile_deplibs finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5464 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5465 for var in $vars dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5466 # Add libraries to $var in reverse order
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5467 eval tmp_libs=\"\$$var\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5468 new_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5469 for deplib in $tmp_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5470 # FIXME: Pedantically, this is the right thing to do, so
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5471 # that some nasty dependency loop isn't accidentally
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5472 # broken:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5473 #new_libs="$deplib $new_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5474 # Pragmatically, this seems to cause very few problems in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5475 # practice:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5476 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5477 -L*) new_libs="$deplib $new_libs" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5478 -R*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5479 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5480 # And here is the reason: when a library appears more
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5481 # than once as an explicit dependence of a library, or
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5482 # is implicitly linked in more than once by the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5483 # compiler, it is considered special, and multiple
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5484 # occurrences thereof are not removed. Compare this
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5485 # with having the same library being listed as a
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5486 # dependency of multiple other libraries: in this case,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5487 # we know (pedantically, we assume) the library does not
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5488 # need to be listed more than once, so we keep only the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5489 # last copy. This is not always right, but it is rare
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5490 # enough that we require users that really mean to play
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5491 # such unportable linking tricks to link the library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5492 # using -Wl,-lname, so that libtool does not consider it
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5493 # for duplicate removal.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5494 case " $specialdeplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5495 *" $deplib "*) new_libs="$deplib $new_libs" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5496 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5497 case " $new_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5498 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5499 *) new_libs="$deplib $new_libs" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5500 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5501 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5502 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5503 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5504 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5505 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5506 tmp_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5507 for deplib in $new_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5508 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5509 -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5510 case " $tmp_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5511 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5512 *) tmp_libs="$tmp_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5513 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5514 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5515 *) tmp_libs="$tmp_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5516 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5517 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5518 eval $var=\"$tmp_libs\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5519 done # for var
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5520 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5521 # Last step: remove runtime libs from dependency_libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5522 # (they stay in deplibs)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5523 tmp_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5524 for i in $dependency_libs ; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5525 case " $predeps $postdeps $compiler_lib_search_path " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5526 *" $i "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5527 i=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5528 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5529 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5530 if test -n "$i" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5531 tmp_libs="$tmp_libs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5532 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5533 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5534 dependency_libs=$tmp_libs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5535 done # for pass
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5536 if test "$linkmode" = prog; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5537 dlfiles="$newdlfiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5538 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5539 if test "$linkmode" = prog || test "$linkmode" = lib; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5540 dlprefiles="$newdlprefiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5541 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5542
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5543 case $linkmode in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5544 oldlib)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5545 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5546 func_warning "\`-dlopen' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5547 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5548
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5549 case " $deplibs" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5550 *\ -l* | *\ -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5551 func_warning "\`-l' and \`-L' are ignored for archives" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5552 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5553
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5554 test -n "$rpath" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5555 func_warning "\`-rpath' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5556
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5557 test -n "$xrpath" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5558 func_warning "\`-R' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5559
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5560 test -n "$vinfo" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5561 func_warning "\`-version-info/-version-number' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5562
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5563 test -n "$release" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5564 func_warning "\`-release' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5565
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5566 test -n "$export_symbols$export_symbols_regex" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5567 func_warning "\`-export-symbols' is ignored for archives"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5568
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5569 # Now set the variables for building old libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5570 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5571 oldlibs="$output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5572 objs="$objs$old_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5573 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5574
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5575 lib)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5576 # Make sure we only generate libraries of the form `libNAME.la'.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5577 case $outputname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5578 lib*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5579 func_stripname 'lib' '.la' "$outputname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5580 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5581 eval shared_ext=\"$shrext_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5582 eval libname=\"$libname_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5583 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5584 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5585 test "$module" = no && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5586 func_fatal_help "libtool library \`$output' must begin with \`lib'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5587
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5588 if test "$need_lib_prefix" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5589 # Add the "lib" prefix for modules if required
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5590 func_stripname '' '.la' "$outputname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5591 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5592 eval shared_ext=\"$shrext_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5593 eval libname=\"$libname_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5594 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5595 func_stripname '' '.la' "$outputname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5596 libname=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5597 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5598 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5599 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5600
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5601 if test -n "$objs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5602 if test "$deplibs_check_method" != pass_all; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5603 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5604 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5605 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5606 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5607 $ECHO "*** objects $objs is not portable!"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5608 libobjs="$libobjs $objs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5609 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5610 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5611
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5612 test "$dlself" != no && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5613 func_warning "\`-dlopen self' is ignored for libtool libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5614
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5615 set dummy $rpath
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5616 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5617 test "$#" -gt 1 && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5618 func_warning "ignoring multiple \`-rpath's for a libtool library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5619
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5620 install_libdir="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5621
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5622 oldlibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5623 if test -z "$rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5624 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5625 # Building a libtool convenience library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5626 # Some compilers have problems with a `.al' extension so
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5627 # convenience libraries should have the same extension an
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5628 # archive normally would.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5629 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5630 build_libtool_libs=convenience
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5631 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5632 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5633
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5634 test -n "$vinfo" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5635 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5636
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5637 test -n "$release" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5638 func_warning "\`-release' is ignored for convenience libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5639 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5640
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5641 # Parse the version information argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5642 save_ifs="$IFS"; IFS=':'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5643 set dummy $vinfo 0 0 0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5644 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5645 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5646
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5647 test -n "$7" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5648 func_fatal_help "too many parameters to \`-version-info'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5649
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5650 # convert absolute version numbers to libtool ages
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5651 # this retains compatibility with .la files and attempts
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5652 # to make the code below a bit more comprehensible
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5653
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5654 case $vinfo_number in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5655 yes)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5656 number_major="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5657 number_minor="$2"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5658 number_revision="$3"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5659 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5660 # There are really only two kinds -- those that
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5661 # use the current revision as the major version
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5662 # and those that subtract age and use age as
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5663 # a minor version. But, then there is irix
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5664 # which has an extra 1 added just for fun
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5665 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5666 case $version_type in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5667 darwin|linux|osf|windows|none)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5668 func_arith $number_major + $number_minor
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5669 current=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5670 age="$number_minor"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5671 revision="$number_revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5672 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5673 freebsd-aout|freebsd-elf|sunos)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5674 current="$number_major"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5675 revision="$number_minor"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5676 age="0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5677 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5678 irix|nonstopux)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5679 func_arith $number_major + $number_minor
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5680 current=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5681 age="$number_minor"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5682 revision="$number_minor"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5683 lt_irix_increment=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5684 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5685 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5686 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5687 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5688 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5689 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5690 no)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5691 current="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5692 revision="$2"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5693 age="$3"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5694 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5695 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5696
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5697 # Check that each of the things are valid numbers.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5698 case $current in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5699 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]) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5700 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5701 func_error "CURRENT \`$current' must be a nonnegative integer"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5702 func_fatal_error "\`$vinfo' is not valid version information"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5703 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5704 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5705
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5706 case $revision in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5707 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]) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5708 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5709 func_error "REVISION \`$revision' must be a nonnegative integer"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5710 func_fatal_error "\`$vinfo' is not valid version information"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5711 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5712 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5713
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5714 case $age in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5715 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]) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5716 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5717 func_error "AGE \`$age' must be a nonnegative integer"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5718 func_fatal_error "\`$vinfo' is not valid version information"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5719 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5720 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5721
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5722 if test "$age" -gt "$current"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5723 func_error "AGE \`$age' is greater than the current interface number \`$current'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5724 func_fatal_error "\`$vinfo' is not valid version information"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5725 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5726
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5727 # Calculate the version variables.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5728 major=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5729 versuffix=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5730 verstring=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5731 case $version_type in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5732 none) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5733
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5734 darwin)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5735 # Like Linux, but with the current version available in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5736 # verstring for coding it into the library header
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5737 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5738 major=.$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5739 versuffix="$major.$age.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5740 # Darwin ld doesn't like 0 for these options...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5741 func_arith $current + 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5742 minor_current=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5743 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5744 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5745 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5746
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5747 freebsd-aout)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5748 major=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5749 versuffix=".$current.$revision";
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5750 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5751
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5752 freebsd-elf)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5753 major=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5754 versuffix=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5755 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5756
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5757 irix | nonstopux)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5758 if test "X$lt_irix_increment" = "Xno"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5759 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5760 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5761 func_arith $current - $age + 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5762 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5763 major=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5764
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5765 case $version_type in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5766 nonstopux) verstring_prefix=nonstopux ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5767 *) verstring_prefix=sgi ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5768 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5769 verstring="$verstring_prefix$major.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5770
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5771 # Add in all the interfaces that we are compatible with.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5772 loop=$revision
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5773 while test "$loop" -ne 0; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5774 func_arith $revision - $loop
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5775 iface=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5776 func_arith $loop - 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5777 loop=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5778 verstring="$verstring_prefix$major.$iface:$verstring"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5779 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5780
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5781 # Before this point, $major must not contain `.'.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5782 major=.$major
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5783 versuffix="$major.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5784 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5785
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5786 linux)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5787 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5788 major=.$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5789 versuffix="$major.$age.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5790 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5791
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5792 osf)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5793 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5794 major=.$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5795 versuffix=".$current.$age.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5796 verstring="$current.$age.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5797
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5798 # Add in all the interfaces that we are compatible with.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5799 loop=$age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5800 while test "$loop" -ne 0; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5801 func_arith $current - $loop
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5802 iface=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5803 func_arith $loop - 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5804 loop=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5805 verstring="$verstring:${iface}.0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5806 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5807
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5808 # Make executables depend on our current version.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5809 verstring="$verstring:${current}.0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5810 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5811
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5812 qnx)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5813 major=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5814 versuffix=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5815 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5816
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5817 sunos)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5818 major=".$current"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5819 versuffix=".$current.$revision"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5820 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5821
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5822 windows)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5823 # Use '-' rather than '.', since we only want one
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5824 # extension on DOS 8.3 filesystems.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5825 func_arith $current - $age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5826 major=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5827 versuffix="-$major"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5828 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5829
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5830 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5831 func_fatal_configuration "unknown library version type \`$version_type'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5832 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5833 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5834
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5835 # Clear the version info if we defaulted, and they specified a release.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5836 if test -z "$vinfo" && test -n "$release"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5837 major=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5838 case $version_type in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5839 darwin)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5840 # we can't check for "0.0" in archive_cmds due to quoting
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5841 # problems, so we reset it completely
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5842 verstring=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5843 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5844 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5845 verstring="0.0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5846 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5847 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5848 if test "$need_version" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5849 versuffix=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5850 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5851 versuffix=".0.0"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5852 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5853 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5854
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5855 # Remove version info from name if versioning should be avoided
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5856 if test "$avoid_version" = yes && test "$need_version" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5857 major=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5858 versuffix=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5859 verstring=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5860 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5861
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5862 # Check to see if the archive will have undefined symbols.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5863 if test "$allow_undefined" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5864 if test "$allow_undefined_flag" = unsupported; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5865 func_warning "undefined symbols not allowed in $host shared libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5866 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5867 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5868 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5869 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5870 # Don't allow undefined symbols.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5871 allow_undefined_flag="$no_undefined_flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5872 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5873
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5874 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5875
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5876 func_generate_dlsyms "$libname" "$libname" "yes"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5877 libobjs="$libobjs $symfileobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5878 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5879
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5880 if test "$mode" != relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5881 # Remove our outputs, but don't remove object files since they
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5882 # may have been created when compiling PIC objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5883 removelist=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5884 tempremovelist=`$ECHO "$output_objdir/*"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5885 for p in $tempremovelist; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5886 case $p in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5887 *.$objext)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5888 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5889 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5890 if test "X$precious_files_regex" != "X"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5891 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5892 then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5893 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5894 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5895 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5896 removelist="$removelist $p"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5897 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5898 *) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5899 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5900 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5901 test -n "$removelist" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5902 func_show_eval "${RM}r \$removelist"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5903 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5904
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5905 # Now set the variables for building old libraries.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5906 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5907 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5908
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5909 # Transform .lo files to .o files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5910 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5911 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5912
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5913 # Eliminate all temporary directories.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5914 #for path in $notinst_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5915 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5916 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5917 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5918 #done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5919
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5920 if test -n "$xrpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5921 # If the user specified any rpath flags, then add them.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5922 temp_xrpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5923 for libdir in $xrpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5924 temp_xrpath="$temp_xrpath -R$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5925 case "$finalize_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5926 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5927 *) finalize_rpath="$finalize_rpath $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5928 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5929 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5930 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5931 dependency_libs="$temp_xrpath $dependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5932 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5933 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5934
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5935 # Make sure dlfiles contains only unique files that won't be dlpreopened
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5936 old_dlfiles="$dlfiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5937 dlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5938 for lib in $old_dlfiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5939 case " $dlprefiles $dlfiles " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5940 *" $lib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5941 *) dlfiles="$dlfiles $lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5942 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5943 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5944
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5945 # Make sure dlprefiles contains only unique files
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5946 old_dlprefiles="$dlprefiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5947 dlprefiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5948 for lib in $old_dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5949 case "$dlprefiles " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5950 *" $lib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5951 *) dlprefiles="$dlprefiles $lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5952 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5953 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5954
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5955 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5956 if test -n "$rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5957 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5958 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5959 # these systems don't actually have a c library (as such)!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5960 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5961 *-*-rhapsody* | *-*-darwin1.[012])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5962 # Rhapsody C library is in the System framework
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5963 deplibs="$deplibs System.ltframework"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5964 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5965 *-*-netbsd*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5966 # Don't link with libc until the a.out ld.so is fixed.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5967 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5968 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5969 # Do not include libc due to us having libc/libc_r.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5970 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5971 *-*-sco3.2v5* | *-*-sco5v6*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5972 # Causes problems with __ctype
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5973 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5974 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5975 # Compiler inserts libc in the correct place for threads to work
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5976 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5977 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5978 # Add libc to deplibs on all other systems if necessary.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5979 if test "$build_libtool_need_lc" = "yes"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5980 deplibs="$deplibs -lc"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5981 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5982 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5983 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5984 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5985
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5986 # Transform deplibs into only deplibs that can be linked in shared.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5987 name_save=$name
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5988 libname_save=$libname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5989 release_save=$release
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5990 versuffix_save=$versuffix
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5991 major_save=$major
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5992 # I'm not sure if I'm treating the release correctly. I think
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5993 # release should show up in the -l (ie -lgmp5) so we don't want to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5994 # add it in twice. Is that correct?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5995 release=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5996 versuffix=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5997 major=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5998 newdeplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5999 droppeddeps=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6000 case $deplibs_check_method in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6001 pass_all)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6002 # Don't check for shared/static. Everything works.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6003 # This might be a little naive. We might want to check
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6004 # whether the library exists or not. But this is on
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6005 # osf3 & osf4 and I'm not really sure... Just
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6006 # implementing what was already the behavior.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6007 newdeplibs=$deplibs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6008 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6009 test_compile)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6010 # This code stresses the "libraries are programs" paradigm to its
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6011 # limits. Maybe even breaks it. We compile a program, linking it
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6012 # against the deplibs as a proxy for the library. Then we can check
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6013 # whether they linked in statically or dynamically with ldd.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6014 $opt_dry_run || $RM conftest.c
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6015 cat > conftest.c <<EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6016 int main() { return 0; }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6017 EOF
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6018 $opt_dry_run || $RM conftest
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6019 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6020 ldd_output=`ldd conftest`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6021 for i in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6022 case $i in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6023 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6024 func_stripname -l '' "$i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6025 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6026 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6027 case " $predeps $postdeps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6028 *" $i "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6029 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6030 i=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6031 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6032 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6033 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6034 if test -n "$i" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6035 libname=`eval "\\$ECHO \"$libname_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6036 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6037 set dummy $deplib_matches; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6038 deplib_match=$1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6039 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6040 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6041 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6042 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6043 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6044 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6045 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6046 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6047 $ECHO "*** shared version of the library, which I believe you do not have"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6048 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6049 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6050 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6051 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6052 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6053 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6054 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6055 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6056 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6057 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6058 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6059 # Error occurred in the first compile. Let's try to salvage
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6060 # the situation: Compile a separate program for each library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6061 for i in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6062 case $i in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6063 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6064 func_stripname -l '' "$i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6065 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6066 $opt_dry_run || $RM conftest
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6067 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6068 ldd_output=`ldd conftest`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6069 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6070 case " $predeps $postdeps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6071 *" $i "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6072 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6073 i=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6074 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6075 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6076 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6077 if test -n "$i" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6078 libname=`eval "\\$ECHO \"$libname_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6079 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6080 set dummy $deplib_matches; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6081 deplib_match=$1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6082 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6083 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6084 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6085 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6086 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6087 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6088 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6089 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6090 $ECHO "*** shared version of the library, which you do not appear to have"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6091 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6092 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6093 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6094 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6095 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6096 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6097 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6098 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6099 $ECHO "*** make it link in! You will probably need to install it or some"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6100 $ECHO "*** library that it depends on before this library will be fully"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6101 $ECHO "*** functional. Installing it before continuing would be even better."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6102 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6103 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6104 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6105 newdeplibs="$newdeplibs $i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6106 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6107 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6108 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6109 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6110 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6111 file_magic*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6112 set dummy $deplibs_check_method; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6113 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6114 for a_deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6115 case $a_deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6116 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6117 func_stripname -l '' "$a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6118 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6119 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6120 case " $predeps $postdeps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6121 *" $a_deplib "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6122 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6123 a_deplib=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6124 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6125 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6126 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6127 if test -n "$a_deplib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6128 libname=`eval "\\$ECHO \"$libname_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6129 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6130 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6131 for potent_lib in $potential_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6132 # Follow soft links.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6133 if ls -lLd "$potent_lib" 2>/dev/null |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6134 $GREP " -> " >/dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6135 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6136 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6137 # The statement above tries to avoid entering an
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6138 # endless loop below, in case of cyclic links.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6139 # We might still enter an endless loop, since a link
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6140 # loop can be closed while we follow links,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6141 # but so what?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6142 potlib="$potent_lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6143 while test -h "$potlib" 2>/dev/null; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6144 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6145 case $potliblink in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6146 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6147 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6148 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6149 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6150 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6151 $SED -e 10q |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6152 $EGREP "$file_magic_regex" > /dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6153 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6154 a_deplib=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6155 break 2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6156 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6157 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6158 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6159 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6160 if test -n "$a_deplib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6161 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6162 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6163 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6164 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6165 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6166 $ECHO "*** shared version of the library, which you do not appear to have"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6167 $ECHO "*** because I did check the linker path looking for a file starting"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6168 if test -z "$potlib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6169 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6170 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6171 $ECHO "*** with $libname and none of the candidates passed a file format test"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6172 $ECHO "*** using a file magic. Last file checked: $potlib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6173 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6174 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6175 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6176 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6177 # Add a -L argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6178 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6179 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6180 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6181 done # Gone through all deplibs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6182 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6183 match_pattern*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6184 set dummy $deplibs_check_method; shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6185 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6186 for a_deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6187 case $a_deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6188 -l*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6189 func_stripname -l '' "$a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6190 name=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6191 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6192 case " $predeps $postdeps " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6193 *" $a_deplib "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6194 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6195 a_deplib=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6196 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6197 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6198 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6199 if test -n "$a_deplib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6200 libname=`eval "\\$ECHO \"$libname_spec\""`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6201 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6202 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6203 for potent_lib in $potential_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6204 potlib="$potent_lib" # see symlink-check above in file_magic test
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6205 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6206 $EGREP "$match_pattern_regex" > /dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6207 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6208 a_deplib=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6209 break 2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6210 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6211 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6212 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6213 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6214 if test -n "$a_deplib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6215 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6216 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6217 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6218 $ECHO "*** I have the capability to make that library automatically link in when"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6219 $ECHO "*** you link to this library. But I can only do this if you have a"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6220 $ECHO "*** shared version of the library, which you do not appear to have"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6221 $ECHO "*** because I did check the linker path looking for a file starting"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6222 if test -z "$potlib" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6223 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6224 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6225 $ECHO "*** with $libname and none of the candidates passed a file format test"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6226 $ECHO "*** using a regex pattern. Last file checked: $potlib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6227 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6228 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6229 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6230 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6231 # Add a -L argument.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6232 newdeplibs="$newdeplibs $a_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6233 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6234 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6235 done # Gone through all deplibs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6236 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6237 none | unknown | *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6238 newdeplibs=""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6239 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6240 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6241 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6242 for i in $predeps $postdeps ; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6243 # can't use Xsed below, because $i might contain '/'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6244 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6245 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6246 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6247 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6248 $GREP . >/dev/null; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6249 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6250 if test "X$deplibs_check_method" = "Xnone"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6251 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6252 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6253 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6254 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6255 $ECHO "*** All declared inter-library dependencies are being dropped."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6256 droppeddeps=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6257 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6258 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6259 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6260 versuffix=$versuffix_save
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6261 major=$major_save
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6262 release=$release_save
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6263 libname=$libname_save
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6264 name=$name_save
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6265
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6266 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6267 *-*-rhapsody* | *-*-darwin1.[012])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6268 # On Rhapsody replace the C library with the System framework
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6269 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6270 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6271 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6272
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6273 if test "$droppeddeps" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6274 if test "$module" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6275 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6276 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6277 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6278 $ECHO "*** a static module, that should work as long as the dlopening"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6279 $ECHO "*** application is linked with the -dlopen flag."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6280 if test -z "$global_symbol_pipe"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6281 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6282 $ECHO "*** However, this would only work if libtool was able to extract symbol"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6283 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6284 $ECHO "*** not find such a program. So, this module is probably useless."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6285 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6286 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6287 if test "$build_old_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6288 oldlibs="$output_objdir/$libname.$libext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6289 build_libtool_libs=module
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6290 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6291 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6292 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6293 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6294 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6295 $ECHO "*** The inter-library dependencies that have been dropped here will be"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6296 $ECHO "*** automatically added whenever a program is linked with this library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6297 $ECHO "*** or is declared to -dlopen it."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6298
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6299 if test "$allow_undefined" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6300 $ECHO
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6301 $ECHO "*** Since this library must not contain undefined symbols,"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6302 $ECHO "*** because either the platform does not support them or"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6303 $ECHO "*** it was explicitly requested with -no-undefined,"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6304 $ECHO "*** libtool will only create a static version of it."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6305 if test "$build_old_libs" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6306 oldlibs="$output_objdir/$libname.$libext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6307 build_libtool_libs=module
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6308 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6309 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6310 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6311 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6312 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6313 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6314 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6315 # Done checking deplibs!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6316 deplibs=$newdeplibs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6317 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6318 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6319 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6320 *-*-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6321 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6322 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6323 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6324 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6325 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6326
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6327 # move library search paths that coincide with paths to not yet
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6328 # installed libraries to the beginning of the library search list
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6329 new_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6330 for path in $notinst_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6331 case " $new_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6332 *" -L$path/$objdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6333 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6334 case " $deplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6335 *" -L$path/$objdir "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6336 new_libs="$new_libs -L$path/$objdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6337 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6338 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6339 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6340 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6341 for deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6342 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6343 -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6344 case " $new_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6345 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6346 *) new_libs="$new_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6347 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6348 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6349 *) new_libs="$new_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6350 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6351 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6352 deplibs="$new_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6353
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6354 # All the library-specific variables (install_libdir is set above).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6355 library_names=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6356 old_library=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6357 dlname=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6358
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6359 # Test again, we may have decided not to build it any more
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6360 if test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6361 if test "$hardcode_into_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6362 # Hardcode the library paths
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6363 hardcode_libdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6364 dep_rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6365 rpath="$finalize_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6366 test "$mode" != relink && rpath="$compile_rpath$rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6367 for libdir in $rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6368 if test -n "$hardcode_libdir_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6369 if test -n "$hardcode_libdir_separator"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6370 if test -z "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6371 hardcode_libdirs="$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6372 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6373 # Just accumulate the unique libdirs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6374 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6375 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6376 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6377 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6378 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6379 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6380 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6381 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6382 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6383 eval flag=\"$hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6384 dep_rpath="$dep_rpath $flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6385 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6386 elif test -n "$runpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6387 case "$perm_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6388 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6389 *) perm_rpath="$perm_rpath $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6390 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6391 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6392 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6393 # Substitute the hardcoded libdirs into the rpath.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6394 if test -n "$hardcode_libdir_separator" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6395 test -n "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6396 libdir="$hardcode_libdirs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6397 if test -n "$hardcode_libdir_flag_spec_ld"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6398 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6399 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6400 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6401 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6402 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6403 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6404 # We should set the runpath_var.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6405 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6406 for dir in $perm_rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6407 rpath="$rpath$dir:"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6408 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6409 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6410 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6411 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6412 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6413
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6414 shlibpath="$finalize_shlibpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6415 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6416 if test -n "$shlibpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6417 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6418 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6419
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6420 # Get the real and link names of the library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6421 eval shared_ext=\"$shrext_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6422 eval library_names=\"$library_names_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6423 set dummy $library_names
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6424 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6425 realname="$1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6426 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6427
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6428 if test -n "$soname_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6429 eval soname=\"$soname_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6430 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6431 soname="$realname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6432 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6433 if test -z "$dlname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6434 dlname=$soname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6435 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6436
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6437 lib="$output_objdir/$realname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6438 linknames=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6439 for link
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6440 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6441 linknames="$linknames $link"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6442 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6443
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6444 # Use standard objects if they are pic
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6445 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6446 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6447
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6448 delfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6449 if test -n "$export_symbols" && test -n "$include_expsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6450 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6451 export_symbols="$output_objdir/$libname.uexp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6452 delfiles="$delfiles $export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6453 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6454
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6455 orig_export_symbols=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6456 case $host_os in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6457 cygwin* | mingw*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6458 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6459 # exporting using user supplied symfile
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6460 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6461 # and it's NOT already a .def file. Must figure out
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6462 # which of the given symbols are data symbols and tag
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6463 # them as such. So, trigger use of export_symbols_cmds.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6464 # export_symbols gets reassigned inside the "prepare
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6465 # the list of exported symbols" if statement, so the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6466 # include_expsyms logic still works.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6467 orig_export_symbols="$export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6468 export_symbols=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6469 always_export_symbols=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6470 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6471 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6472 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6473 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6474
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6475 # Prepare the list of exported symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6476 if test -z "$export_symbols"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6477 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6478 func_verbose "generating symbol list for \`$libname.la'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6479 export_symbols="$output_objdir/$libname.exp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6480 $opt_dry_run || $RM $export_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6481 cmds=$export_symbols_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6482 save_ifs="$IFS"; IFS='~'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6483 for cmd in $cmds; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6484 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6485 eval cmd=\"$cmd\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6486 func_len " $cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6487 len=$func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6488 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6489 func_show_eval "$cmd" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6490 skipped_export=false
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6491 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6492 # The command line is too long to execute in one step.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6493 func_verbose "using reloadable object file for export list..."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6494 skipped_export=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6495 # Break out early, otherwise skipped_export may be
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6496 # set to false by a later but shorter cmd.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6497 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6498 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6499 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6500 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6501 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6502 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6503 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6504 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6505 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6506 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6507
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6508 if test -n "$export_symbols" && test -n "$include_expsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6509 tmp_export_symbols="$export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6510 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6511 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6512 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6513
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6514 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6515 # The given exports_symbols file has to be filtered, so filter it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6516 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6517 # FIXME: $output_objdir/$libname.filter potentially contains lots of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6518 # 's' commands which not all seds can handle. GNU sed should be fine
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6519 # though. Also, the filter scales superlinearly with the number of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6520 # global variables. join(1) would be nice here, but unfortunately
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6521 # isn't a blessed tool.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6522 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6523 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6524 export_symbols=$output_objdir/$libname.def
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6525 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6526 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6527
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6528 tmp_deplibs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6529 for test_deplib in $deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6530 case " $convenience " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6531 *" $test_deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6532 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6533 tmp_deplibs="$tmp_deplibs $test_deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6534 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6535 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6536 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6537 deplibs="$tmp_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6538
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6539 if test -n "$convenience"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6540 if test -n "$whole_archive_flag_spec" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6541 test "$compiler_needs_object" = yes &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6542 test -z "$libobjs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6543 # extract the archives, so we have objects to list.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6544 # TODO: could optimize this to just extract one archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6545 whole_archive_flag_spec=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6546 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6547 if test -n "$whole_archive_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6548 save_libobjs=$libobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6549 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6550 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6551 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6552 gentop="$output_objdir/${outputname}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6553 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6554
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6555 func_extract_archives $gentop $convenience
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6556 libobjs="$libobjs $func_extract_archives_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6557 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6558 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6559 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6560
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6561 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6562 eval flag=\"$thread_safe_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6563 linker_flags="$linker_flags $flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6564 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6565
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6566 # Make a backup of the uninstalled library when relinking
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6567 if test "$mode" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6568 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6569 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6570
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6571 # Do each of the archive commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6572 if test "$module" = yes && test -n "$module_cmds" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6573 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6574 eval test_cmds=\"$module_expsym_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6575 cmds=$module_expsym_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6576 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6577 eval test_cmds=\"$module_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6578 cmds=$module_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6579 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6580 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6581 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6582 eval test_cmds=\"$archive_expsym_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6583 cmds=$archive_expsym_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6584 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6585 eval test_cmds=\"$archive_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6586 cmds=$archive_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6587 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6588 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6589
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6590 if test "X$skipped_export" != "X:" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6591 func_len " $test_cmds" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6592 len=$func_len_result &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6593 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6594 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6595 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6596 # The command line is too long to link in one step, link piecewise
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6597 # or, if using GNU ld and skipped_export is not :, use a linker
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6598 # script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6599
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6600 # Save the value of $output and $libobjs because we want to
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6601 # use them later. If we have whole_archive_flag_spec, we
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6602 # want to use save_libobjs as it was before
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6603 # whole_archive_flag_spec was expanded, because we can't
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6604 # assume the linker understands whole_archive_flag_spec.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6605 # This may have to be revisited, in case too many
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6606 # convenience libraries get linked in and end up exceeding
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6607 # the spec.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6608 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6609 save_libobjs=$libobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6610 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6611 save_output=$output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6612 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6613
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6614 # Clear the reloadable object creation command queue and
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6615 # initialize k to one.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6616 test_cmds=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6617 concat_cmds=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6618 objlist=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6619 last_robj=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6620 k=1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6621
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6622 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6623 output=${output_objdir}/${output_la}.lnkscript
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6624 func_verbose "creating GNU ld script: $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6625 $ECHO 'INPUT (' > $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6626 for obj in $save_libobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6627 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6628 $ECHO "$obj" >> $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6629 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6630 $ECHO ')' >> $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6631 delfiles="$delfiles $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6632 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6633 output=${output_objdir}/${output_la}.lnk
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6634 func_verbose "creating linker input file list: $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6635 : > $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6636 set x $save_libobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6637 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6638 firstobj=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6639 if test "$compiler_needs_object" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6640 firstobj="$1 "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6641 shift
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6642 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6643 for obj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6644 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6645 $ECHO "$obj" >> $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6646 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6647 delfiles="$delfiles $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6648 output=$firstobj\"$file_list_spec$output\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6649 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6650 if test -n "$save_libobjs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6651 func_verbose "creating reloadable object files..."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6652 output=$output_objdir/$output_la-${k}.$objext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6653 eval test_cmds=\"$reload_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6654 func_len " $test_cmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6655 len0=$func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6656 len=$len0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6657
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6658 # Loop over the list of objects to be linked.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6659 for obj in $save_libobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6660 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6661 func_len " $obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6662 func_arith $len + $func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6663 len=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6664 if test "X$objlist" = X ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6665 test "$len" -lt "$max_cmd_len"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6666 func_append objlist " $obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6667 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6668 # The command $test_cmds is almost too long, add a
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6669 # command to the queue.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6670 if test "$k" -eq 1 ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6671 # The first file doesn't have a previous command to add.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6672 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6673 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6674 # All subsequent reloadable object files will link in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6675 # the last one created.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6676 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6677 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6678 last_robj=$output_objdir/$output_la-${k}.$objext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6679 func_arith $k + 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6680 k=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6681 output=$output_objdir/$output_la-${k}.$objext
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6682 objlist=$obj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6683 func_len " $last_robj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6684 func_arith $len0 + $func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6685 len=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6686 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6687 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6688 # Handle the remaining objects by creating one last
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6689 # reloadable object file. All subsequent reloadable object
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6690 # files will link in the last one created.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6691 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6692 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6693 if test -n "$last_robj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6694 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6695 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6696 delfiles="$delfiles $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6697
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6698 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6699 output=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6700 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6701
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6702 if ${skipped_export-false}; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6703 func_verbose "generating symbol list for \`$libname.la'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6704 export_symbols="$output_objdir/$libname.exp"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6705 $opt_dry_run || $RM $export_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6706 libobjs=$output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6707 # Append the command to create the export file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6708 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6709 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6710 if test -n "$last_robj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6711 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6712 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6713 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6714
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6715 test -n "$save_libobjs" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6716 func_verbose "creating a temporary reloadable object file: $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6717
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6718 # Loop through the commands generated above and execute them.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6719 save_ifs="$IFS"; IFS='~'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6720 for cmd in $concat_cmds; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6721 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6722 $opt_silent || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6723 func_quote_for_expand "$cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6724 eval "func_echo $func_quote_for_expand_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6725 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6726 $opt_dry_run || eval "$cmd" || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6727 lt_exit=$?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6728
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6729 # Restore the uninstalled library and exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6730 if test "$mode" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6731 ( cd "$output_objdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6732 $RM "${realname}T" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6733 $MV "${realname}U" "$realname" )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6734 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6735
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6736 exit $lt_exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6737 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6738 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6739 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6740
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6741 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6742 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6743 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6744 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6745 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6746
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6747 if ${skipped_export-false}; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6748 if test -n "$export_symbols" && test -n "$include_expsyms"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6749 tmp_export_symbols="$export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6750 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6751 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6752 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6753
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6754 if test -n "$orig_export_symbols"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6755 # The given exports_symbols file has to be filtered, so filter it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6756 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6757 # FIXME: $output_objdir/$libname.filter potentially contains lots of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6758 # 's' commands which not all seds can handle. GNU sed should be fine
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6759 # though. Also, the filter scales superlinearly with the number of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6760 # global variables. join(1) would be nice here, but unfortunately
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6761 # isn't a blessed tool.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6762 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6763 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6764 export_symbols=$output_objdir/$libname.def
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6765 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6766 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6767 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6768
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6769 libobjs=$output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6770 # Restore the value of output.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6771 output=$save_output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6772
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6773 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6774 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6775 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6776 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6777 # Expand the library linking commands again to reset the
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6778 # value of $libobjs for piecewise linking.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6779
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6780 # Do each of the archive commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6781 if test "$module" = yes && test -n "$module_cmds" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6782 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6783 cmds=$module_expsym_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6784 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6785 cmds=$module_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6786 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6787 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6788 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6789 cmds=$archive_expsym_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6790 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6791 cmds=$archive_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6792 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6793 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6794 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6795
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6796 if test -n "$delfiles"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6797 # Append the command to remove temporary files to $cmds.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6798 eval cmds=\"\$cmds~\$RM $delfiles\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6799 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6800
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6801 # Add any objects from preloaded convenience libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6802 if test -n "$dlprefiles"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6803 gentop="$output_objdir/${outputname}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6804 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6805
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6806 func_extract_archives $gentop $dlprefiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6807 libobjs="$libobjs $func_extract_archives_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6808 test "X$libobjs" = "X " && libobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6809 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6810
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6811 save_ifs="$IFS"; IFS='~'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6812 for cmd in $cmds; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6813 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6814 eval cmd=\"$cmd\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6815 $opt_silent || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6816 func_quote_for_expand "$cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6817 eval "func_echo $func_quote_for_expand_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6818 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6819 $opt_dry_run || eval "$cmd" || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6820 lt_exit=$?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6821
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6822 # Restore the uninstalled library and exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6823 if test "$mode" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6824 ( cd "$output_objdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6825 $RM "${realname}T" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6826 $MV "${realname}U" "$realname" )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6827 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6828
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6829 exit $lt_exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6830 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6831 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6832 IFS="$save_ifs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6833
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6834 # Restore the uninstalled library and exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6835 if test "$mode" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6836 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6837
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6838 if test -n "$convenience"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6839 if test -z "$whole_archive_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6840 func_show_eval '${RM}r "$gentop"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6841 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6842 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6843
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6844 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6845 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6846
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6847 # Create links to the real library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6848 for linkname in $linknames; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6849 if test "$realname" != "$linkname"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6850 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6851 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6852 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6853
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6854 # If -module or -export-dynamic was specified, set the dlname.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6855 if test "$module" = yes || test "$export_dynamic" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6856 # On all known operating systems, these are identical.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6857 dlname="$soname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6858 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6859 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6860 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6861
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6862 obj)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6863 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6864 func_warning "\`-dlopen' is ignored for objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6865 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6866
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6867 case " $deplibs" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6868 *\ -l* | *\ -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6869 func_warning "\`-l' and \`-L' are ignored for objects" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6870 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6871
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6872 test -n "$rpath" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6873 func_warning "\`-rpath' is ignored for objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6874
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6875 test -n "$xrpath" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6876 func_warning "\`-R' is ignored for objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6877
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6878 test -n "$vinfo" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6879 func_warning "\`-version-info' is ignored for objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6880
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6881 test -n "$release" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6882 func_warning "\`-release' is ignored for objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6883
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6884 case $output in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6885 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6886 test -n "$objs$old_deplibs" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6887 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6888
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6889 libobj=$output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6890 func_lo2o "$libobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6891 obj=$func_lo2o_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6892 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6893 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6894 libobj=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6895 obj="$output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6896 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6897 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6898
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6899 # Delete the old objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6900 $opt_dry_run || $RM $obj $libobj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6901
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6902 # Objects from convenience libraries. This assumes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6903 # single-version convenience libraries. Whenever we create
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6904 # different ones for PIC/non-PIC, this we'll have to duplicate
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6905 # the extraction.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6906 reload_conv_objs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6907 gentop=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6908 # reload_cmds runs $LD directly, so let us get rid of
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6909 # -Wl from whole_archive_flag_spec and hope we can get by with
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6910 # turning comma into space..
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6911 wl=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6912
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6913 if test -n "$convenience"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6914 if test -n "$whole_archive_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6915 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6916 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6917 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6918 gentop="$output_objdir/${obj}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6919 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6920
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6921 func_extract_archives $gentop $convenience
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6922 reload_conv_objs="$reload_objs $func_extract_archives_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6923 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6924 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6925
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6926 # Create the old-style object.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6927 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
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6928
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6929 output="$obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6930 func_execute_cmds "$reload_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6931
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6932 # Exit if we aren't doing a library object file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6933 if test -z "$libobj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6934 if test -n "$gentop"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6935 func_show_eval '${RM}r "$gentop"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6936 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6937
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6938 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6939 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6940
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6941 if test "$build_libtool_libs" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6942 if test -n "$gentop"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6943 func_show_eval '${RM}r "$gentop"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6944 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6945
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6946 # Create an invalid libtool object if no PIC, so that we don't
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6947 # accidentally link it into a program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6948 # $show "echo timestamp > $libobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6949 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6950 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6951 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6952
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6953 if test -n "$pic_flag" || test "$pic_mode" != default; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6954 # Only do commands if we really have different PIC objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6955 reload_objs="$libobjs $reload_conv_objs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6956 output="$libobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6957 func_execute_cmds "$reload_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6958 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6959
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6960 if test -n "$gentop"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6961 func_show_eval '${RM}r "$gentop"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6962 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6963
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6964 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6965 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6966
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6967 prog)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6968 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6969 *cygwin*) func_stripname '' '.exe' "$output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6970 output=$func_stripname_result.exe;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6971 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6972 test -n "$vinfo" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6973 func_warning "\`-version-info' is ignored for programs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6974
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6975 test -n "$release" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6976 func_warning "\`-release' is ignored for programs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6977
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6978 test "$preload" = yes \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6979 && test "$dlopen_support" = unknown \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6980 && test "$dlopen_self" = unknown \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6981 && test "$dlopen_self_static" = unknown && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6982 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6983
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6984 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6985 *-*-rhapsody* | *-*-darwin1.[012])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6986 # On Rhapsody replace the C library is the System framework
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6987 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6988 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6989 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6990 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6991
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6992 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6993 *-*-darwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6994 # Don't allow lazy linking, it breaks C++ global constructors
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6995 # But is supposedly fixed on 10.4 or later (yay!).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6996 if test "$tagname" = CXX ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6997 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6998 10.[0123])
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6999 compile_command="$compile_command ${wl}-bind_at_load"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7000 finalize_command="$finalize_command ${wl}-bind_at_load"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7001 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7002 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7003 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7004 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7005 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7006 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7007 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7008 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7009
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7010
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7011 # move library search paths that coincide with paths to not yet
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7012 # installed libraries to the beginning of the library search list
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7013 new_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7014 for path in $notinst_path; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7015 case " $new_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7016 *" -L$path/$objdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7017 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7018 case " $compile_deplibs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7019 *" -L$path/$objdir "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7020 new_libs="$new_libs -L$path/$objdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7021 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7022 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7023 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7024 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7025 for deplib in $compile_deplibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7026 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7027 -L*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7028 case " $new_libs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7029 *" $deplib "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7030 *) new_libs="$new_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7031 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7032 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7033 *) new_libs="$new_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7034 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7035 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7036 compile_deplibs="$new_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7037
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7038
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7039 compile_command="$compile_command $compile_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7040 finalize_command="$finalize_command $finalize_deplibs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7041
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7042 if test -n "$rpath$xrpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7043 # If the user specified any rpath flags, then add them.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7044 for libdir in $rpath $xrpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7045 # This is the magic to use -rpath.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7046 case "$finalize_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7047 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7048 *) finalize_rpath="$finalize_rpath $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7049 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7050 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7051 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7052
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7053 # Now hardcode the library paths
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7054 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7055 hardcode_libdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7056 for libdir in $compile_rpath $finalize_rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7057 if test -n "$hardcode_libdir_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7058 if test -n "$hardcode_libdir_separator"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7059 if test -z "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7060 hardcode_libdirs="$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7061 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7062 # Just accumulate the unique libdirs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7063 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7064 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7065 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7066 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7067 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7068 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7069 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7070 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7071 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7072 eval flag=\"$hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7073 rpath="$rpath $flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7074 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7075 elif test -n "$runpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7076 case "$perm_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7077 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7078 *) perm_rpath="$perm_rpath $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7079 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7080 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7081 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7082 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7083 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7084 case :$dllsearchpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7085 *":$libdir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7086 *) dllsearchpath="$dllsearchpath:$libdir";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7087 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7088 case :$dllsearchpath: in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7089 *":$testbindir:"*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7090 *) dllsearchpath="$dllsearchpath:$testbindir";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7091 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7092 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7093 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7094 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7095 # Substitute the hardcoded libdirs into the rpath.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7096 if test -n "$hardcode_libdir_separator" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7097 test -n "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7098 libdir="$hardcode_libdirs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7099 eval rpath=\" $hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7100 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7101 compile_rpath="$rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7102
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7103 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7104 hardcode_libdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7105 for libdir in $finalize_rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7106 if test -n "$hardcode_libdir_flag_spec"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7107 if test -n "$hardcode_libdir_separator"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7108 if test -z "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7109 hardcode_libdirs="$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7110 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7111 # Just accumulate the unique libdirs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7112 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7113 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7114 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7115 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7116 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7117 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7118 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7119 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7120 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7121 eval flag=\"$hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7122 rpath="$rpath $flag"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7123 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7124 elif test -n "$runpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7125 case "$finalize_perm_rpath " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7126 *" $libdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7127 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7128 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7129 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7130 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7131 # Substitute the hardcoded libdirs into the rpath.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7132 if test -n "$hardcode_libdir_separator" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7133 test -n "$hardcode_libdirs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7134 libdir="$hardcode_libdirs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7135 eval rpath=\" $hardcode_libdir_flag_spec\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7136 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7137 finalize_rpath="$rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7138
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7139 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7140 # Transform all the library objects into standard objects.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7141 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7142 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7143 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7144
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7145 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7146
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7147 # template prelinking step
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7148 if test -n "$prelink_cmds"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7149 func_execute_cmds "$prelink_cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7150 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7151
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7152 wrappers_required=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7153 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7154 *cygwin* | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7155 if test "$build_libtool_libs" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7156 wrappers_required=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7157 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7158 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7159 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7160 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7161 wrappers_required=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7162 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7163 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7164 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7165 if test "$wrappers_required" = no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7166 # Replace the output file specification.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7167 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7168 link_command="$compile_command$compile_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7169
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7170 # We have no uninstalled library dependencies, so finalize right now.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7171 exit_status=0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7172 func_show_eval "$link_command" 'exit_status=$?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7173
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7174 # Delete the generated files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7175 if test -f "$output_objdir/${outputname}S.${objext}"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7176 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7177 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7178
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7179 exit $exit_status
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7180 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7181
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7182 if test -n "$compile_shlibpath$finalize_shlibpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7183 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7184 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7185 if test -n "$finalize_shlibpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7186 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7187 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7188
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7189 compile_var=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7190 finalize_var=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7191 if test -n "$runpath_var"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7192 if test -n "$perm_rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7193 # We should set the runpath_var.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7194 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7195 for dir in $perm_rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7196 rpath="$rpath$dir:"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7197 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7198 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7199 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7200 if test -n "$finalize_perm_rpath"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7201 # We should set the runpath_var.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7202 rpath=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7203 for dir in $finalize_perm_rpath; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7204 rpath="$rpath$dir:"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7205 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7206 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7207 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7208 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7209
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7210 if test "$no_install" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7211 # We don't need to create a wrapper script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7212 link_command="$compile_var$compile_command$compile_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7213 # Replace the output file specification.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7214 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7215 # Delete the old output file.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7216 $opt_dry_run || $RM $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7217 # Link the executable and exit
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7218 func_show_eval "$link_command" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7219 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7220 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7221
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7222 if test "$hardcode_action" = relink; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7223 # Fast installation is not supported
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7224 link_command="$compile_var$compile_command$compile_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7225 relink_command="$finalize_var$finalize_command$finalize_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7226
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7227 func_warning "this platform does not like uninstalled shared libraries"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7228 func_warning "\`$output' will be relinked during installation"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7229 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7230 if test "$fast_install" != no; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7231 link_command="$finalize_var$compile_command$finalize_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7232 if test "$fast_install" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7233 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7234 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7235 # fast_install is set to needless
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7236 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7237 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7238 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7239 link_command="$compile_var$compile_command$compile_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7240 relink_command="$finalize_var$finalize_command$finalize_rpath"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7241 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7242 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7243
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7244 # Replace the output file specification.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7245 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7246
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7247 # Delete the old output files.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7248 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7249
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7250 func_show_eval "$link_command" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7251
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7252 # Now create the wrapper script.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7253 func_verbose "creating $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7254
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7255 # Quote the relink command for shipping.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7256 if test -n "$relink_command"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7257 # Preserve any variables that may affect compiler behavior
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7258 for var in $variables_saved_for_relink; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7259 if eval test -z \"\${$var+set}\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7260 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7261 elif eval var_value=\$$var; test -z "$var_value"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7262 relink_command="$var=; export $var; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7263 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7264 func_quote_for_eval "$var_value"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7265 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7266 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7267 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7268 relink_command="(cd `pwd`; $relink_command)"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7269 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7270 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7271
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7272 # Quote $ECHO for shipping.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7273 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7274 case $progpath in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7275 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7276 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7277 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7278 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7279 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7280 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7281 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7282
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7283 # Only actually do things if not in dry run mode.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7284 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7285 # win32 will think the script is a binary if it has
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7286 # a .exe suffix, so we strip it off here.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7287 case $output in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7288 *.exe) func_stripname '' '.exe' "$output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7289 output=$func_stripname_result ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7290 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7291 # test for cygwin because mv fails w/o .exe extensions
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7292 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7293 *cygwin*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7294 exeext=.exe
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7295 func_stripname '' '.exe' "$outputname"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7296 outputname=$func_stripname_result ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7297 *) exeext= ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7298 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7299 case $host in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7300 *cygwin* | *mingw* )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7301 func_dirname_and_basename "$output" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7302 output_name=$func_basename_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7303 output_path=$func_dirname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7304 cwrappersource="$output_path/$objdir/lt-$output_name.c"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7305 cwrapper="$output_path/$output_name.exe"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7306 $RM $cwrappersource $cwrapper
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7307 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7308
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7309 func_emit_cwrapperexe_src > $cwrappersource
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7310
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7311 # we should really use a build-platform specific compiler
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7312 # here, but OTOH, the wrappers (shell script and this C one)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7313 # are only useful if you want to execute the "real" binary.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7314 # Since the "real" binary is built for $host, then this
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7315 # wrapper might as well be built for $host, too.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7316 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7317 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7318 $STRIP $cwrapper
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7319 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7320
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7321 # Now, create the wrapper script for func_source use:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7322 func_ltwrapper_scriptname $cwrapper
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7323 $RM $func_ltwrapper_scriptname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7324 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7325 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7326 # note: this script will not be executed, so do not chmod.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7327 if test "x$build" = "x$host" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7328 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7329 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7330 func_emit_wrapper no > $func_ltwrapper_scriptname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7331 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7332 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7333 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7334 * )
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7335 $RM $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7336 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7337
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7338 func_emit_wrapper no > $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7339 chmod +x $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7340 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7341 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7342 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7343 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7344 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7345 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7346
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7347 # See if we need to build an old-fashioned archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7348 for oldlib in $oldlibs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7349
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7350 if test "$build_libtool_libs" = convenience; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7351 oldobjs="$libobjs_save $symfileobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7352 addlibs="$convenience"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7353 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7354 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7355 if test "$build_libtool_libs" = module; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7356 oldobjs="$libobjs_save"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7357 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7358 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7359 oldobjs="$old_deplibs $non_pic_objects"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7360 if test "$preload" = yes && test -f "$symfileobj"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7361 oldobjs="$oldobjs $symfileobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7362 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7363 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7364 addlibs="$old_convenience"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7365 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7366
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7367 if test -n "$addlibs"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7368 gentop="$output_objdir/${outputname}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7369 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7370
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7371 func_extract_archives $gentop $addlibs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7372 oldobjs="$oldobjs $func_extract_archives_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7373 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7374
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7375 # Do each command in the archive commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7376 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7377 cmds=$old_archive_from_new_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7378 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7379
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7380 # Add any objects from preloaded convenience libraries
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7381 if test -n "$dlprefiles"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7382 gentop="$output_objdir/${outputname}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7383 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7384
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7385 func_extract_archives $gentop $dlprefiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7386 oldobjs="$oldobjs $func_extract_archives_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7387 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7388
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7389 # POSIX demands no paths to be encoded in archives. We have
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7390 # to avoid creating archives with duplicate basenames if we
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7391 # might have to extract them afterwards, e.g., when creating a
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7392 # static archive out of a convenience library, or when linking
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7393 # the entirety of a libtool archive into another (currently
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7394 # not supported by libtool).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7395 if (for obj in $oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7396 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7397 func_basename "$obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7398 $ECHO "$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7399 done | sort | sort -uc >/dev/null 2>&1); then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7400 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7401 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7402 $ECHO "copying selected object files to avoid basename conflicts..."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7403 gentop="$output_objdir/${outputname}x"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7404 generated="$generated $gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7405 func_mkdir_p "$gentop"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7406 save_oldobjs=$oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7407 oldobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7408 counter=1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7409 for obj in $save_oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7410 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7411 func_basename "$obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7412 objbase="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7413 case " $oldobjs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7414 " ") oldobjs=$obj ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7415 *[\ /]"$objbase "*)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7416 while :; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7417 # Make sure we don't pick an alternate name that also
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7418 # overlaps.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7419 newobj=lt$counter-$objbase
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7420 func_arith $counter + 1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7421 counter=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7422 case " $oldobjs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7423 *[\ /]"$newobj "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7424 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7425 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7426 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7427 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7428 oldobjs="$oldobjs $gentop/$newobj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7429 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7430 *) oldobjs="$oldobjs $obj" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7431 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7432 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7433 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7434 eval cmds=\"$old_archive_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7435
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7436 func_len " $cmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7437 len=$func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7438 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7439 cmds=$old_archive_cmds
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7440 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7441 # the command line is too long to link in one step, link in parts
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7442 func_verbose "using piecewise archive linking..."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7443 save_RANLIB=$RANLIB
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7444 RANLIB=:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7445 objlist=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7446 concat_cmds=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7447 save_oldobjs=$oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7448 oldobjs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7449 # Is there a better way of finding the last object in the list?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7450 for obj in $save_oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7451 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7452 last_oldobj=$obj
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7453 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7454 eval test_cmds=\"$old_archive_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7455 func_len " $test_cmds"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7456 len0=$func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7457 len=$len0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7458 for obj in $save_oldobjs
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7459 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7460 func_len " $obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7461 func_arith $len + $func_len_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7462 len=$func_arith_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7463 func_append objlist " $obj"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7464 if test "$len" -lt "$max_cmd_len"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7465 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7466 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7467 # the above command should be used before it gets too long
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7468 oldobjs=$objlist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7469 if test "$obj" = "$last_oldobj" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7470 RANLIB=$save_RANLIB
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7471 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7472 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7473 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7474 objlist=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7475 len=$len0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7476 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7477 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7478 RANLIB=$save_RANLIB
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7479 oldobjs=$objlist
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7480 if test "X$oldobjs" = "X" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7481 eval cmds=\"\$concat_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7482 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7483 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7484 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7485 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7486 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7487 func_execute_cmds "$cmds" 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7488 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7489
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7490 test -n "$generated" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7491 func_show_eval "${RM}r$generated"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7492
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7493 # Now create the libtool archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7494 case $output in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7495 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7496 old_library=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7497 test "$build_old_libs" = yes && old_library="$libname.$libext"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7498 func_verbose "creating $output"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7499
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7500 # Preserve any variables that may affect compiler behavior
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7501 for var in $variables_saved_for_relink; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7502 if eval test -z \"\${$var+set}\"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7503 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7504 elif eval var_value=\$$var; test -z "$var_value"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7505 relink_command="$var=; export $var; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7506 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7507 func_quote_for_eval "$var_value"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7508 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7509 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7510 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7511 # Quote the link command for shipping.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7512 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7513 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7514 if test "$hardcode_automatic" = yes ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7515 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7516 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7517
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7518 # Only create the output if not a dry run.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7519 $opt_dry_run || {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7520 for installed in no yes; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7521 if test "$installed" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7522 if test -z "$install_libdir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7523 break
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7524 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7525 output="$output_objdir/$outputname"i
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7526 # Replace all uninstalled libtool libraries with the installed ones
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7527 newdependency_libs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7528 for deplib in $dependency_libs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7529 case $deplib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7530 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7531 func_basename "$deplib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7532 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7533 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7534 test -z "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7535 func_fatal_error "\`$deplib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7536 newdependency_libs="$newdependency_libs $libdir/$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7537 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7538 *) newdependency_libs="$newdependency_libs $deplib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7539 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7540 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7541 dependency_libs="$newdependency_libs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7542 newdlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7543
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7544 for lib in $dlfiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7545 case $lib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7546 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7547 func_basename "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7548 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7549 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7550 test -z "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7551 func_fatal_error "\`$lib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7552 newdlfiles="$newdlfiles $libdir/$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7553 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7554 *) newdlfiles="$newdlfiles $lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7555 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7556 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7557 dlfiles="$newdlfiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7558 newdlprefiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7559 for lib in $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7560 case $lib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7561 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7562 # Only pass preopened files to the pseudo-archive (for
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7563 # eventual linking with the app. that links it) if we
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7564 # didn't already link the preopened objects directly into
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7565 # the library:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7566 func_basename "$lib"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7567 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7568 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7569 test -z "$libdir" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7570 func_fatal_error "\`$lib' is not a valid libtool archive"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7571 newdlprefiles="$newdlprefiles $libdir/$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7572 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7573 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7574 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7575 dlprefiles="$newdlprefiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7576 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7577 newdlfiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7578 for lib in $dlfiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7579 case $lib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7580 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7581 *) abs=`pwd`"/$lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7582 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7583 newdlfiles="$newdlfiles $abs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7584 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7585 dlfiles="$newdlfiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7586 newdlprefiles=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7587 for lib in $dlprefiles; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7588 case $lib in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7589 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7590 *) abs=`pwd`"/$lib" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7591 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7592 newdlprefiles="$newdlprefiles $abs"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7593 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7594 dlprefiles="$newdlprefiles"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7595 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7596 $RM $output
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7597 # place dlname in correct position for cygwin
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7598 tdlname=$dlname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7599 case $host,$output,$installed,$module,$dlname in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7600 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7601 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7602 $ECHO > $output "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7603 # $outputname - a libtool library file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7604 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7605 #
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7606 # Please DO NOT delete this file!
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7607 # It is necessary for linking the library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7608
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7609 # The name that we can dlopen(3).
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7610 dlname='$tdlname'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7611
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7612 # Names of this library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7613 library_names='$library_names'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7614
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7615 # The name of the static archive.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7616 old_library='$old_library'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7617
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7618 # Linker flags that can not go in dependency_libs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7619 inherited_linker_flags='$new_inherited_linker_flags'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7620
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7621 # Libraries that this one depends upon.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7622 dependency_libs='$dependency_libs'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7623
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7624 # Names of additional weak libraries provided by this library
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7625 weak_library_names='$weak_libs'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7626
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7627 # Version information for $libname.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7628 current=$current
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7629 age=$age
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7630 revision=$revision
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7631
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7632 # Is this an already installed library?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7633 installed=$installed
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7634
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7635 # Should we warn about portability when linking against -modules?
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7636 shouldnotlink=$module
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7637
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7638 # Files to dlopen/dlpreopen
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7639 dlopen='$dlfiles'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7640 dlpreopen='$dlprefiles'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7641
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7642 # Directory that this library needs to be installed in:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7643 libdir='$install_libdir'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7644 if test "$installed" = no && test "$need_relink" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7645 $ECHO >> $output "\
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7646 relink_command=\"$relink_command\""
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7647 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7648 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7649 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7650
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7651 # Do a symbolic link so that the libtool archive can be found in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7652 # LD_LIBRARY_PATH before the program is installed.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7653 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7654 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7655 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7656 exit $EXIT_SUCCESS
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7657 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7658
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7659 { test "$mode" = link || test "$mode" = relink; } &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7660 func_mode_link ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7661
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7662
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7663 # func_mode_uninstall arg...
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7664 func_mode_uninstall ()
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7665 {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7666 $opt_debug
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7667 RM="$nonopt"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7668 files=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7669 rmforce=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7670 exit_status=0
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7671
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7672 # This variable tells wrapper scripts just to set variables rather
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7673 # than running their programs.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7674 libtool_install_magic="$magic"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7675
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7676 for arg
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7677 do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7678 case $arg in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7679 -f) RM="$RM $arg"; rmforce=yes ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7680 -*) RM="$RM $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7681 *) files="$files $arg" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7682 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7683 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7684
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7685 test -z "$RM" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7686 func_fatal_help "you must specify an RM program"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7687
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7688 rmdirs=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7689
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7690 origobjdir="$objdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7691 for file in $files; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7692 func_dirname "$file" "" "."
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7693 dir="$func_dirname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7694 if test "X$dir" = X.; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7695 objdir="$origobjdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7696 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7697 objdir="$dir/$origobjdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7698 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7699 func_basename "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7700 name="$func_basename_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7701 test "$mode" = uninstall && objdir="$dir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7702
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7703 # Remember objdir for removal later, being careful to avoid duplicates
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7704 if test "$mode" = clean; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7705 case " $rmdirs " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7706 *" $objdir "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7707 *) rmdirs="$rmdirs $objdir" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7708 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7709 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7710
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7711 # Don't error if the file doesn't exist and rm -f was used.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7712 if { test -L "$file"; } >/dev/null 2>&1 ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7713 { test -h "$file"; } >/dev/null 2>&1 ||
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7714 test -f "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7715 :
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7716 elif test -d "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7717 exit_status=1
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7718 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7719 elif test "$rmforce" = yes; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7720 continue
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7721 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7722
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7723 rmfiles="$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7724
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7725 case $name in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7726 *.la)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7727 # Possibly a libtool archive, so verify it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7728 if func_lalib_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7729 func_source $dir/$name
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7730
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7731 # Delete the libtool libraries and symlinks.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7732 for n in $library_names; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7733 rmfiles="$rmfiles $objdir/$n"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7734 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7735 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7736
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7737 case "$mode" in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7738 clean)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7739 case " $library_names " in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7740 # " " in the beginning catches empty $dlname
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7741 *" $dlname "*) ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7742 *) rmfiles="$rmfiles $objdir/$dlname" ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7743 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7744 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7745 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7746 uninstall)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7747 if test -n "$library_names"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7748 # Do each command in the postuninstall commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7749 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7750 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7751
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7752 if test -n "$old_library"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7753 # Do each command in the old_postuninstall commands.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7754 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7755 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7756 # FIXME: should reinstall the best remaining shared library.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7757 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7758 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7759 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7760 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7761
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7762 *.lo)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7763 # Possibly a libtool object, so verify it.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7764 if func_lalib_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7765
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7766 # Read the .lo file
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7767 func_source $dir/$name
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7768
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7769 # Add PIC object to the list of files to remove.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7770 if test -n "$pic_object" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7771 test "$pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7772 rmfiles="$rmfiles $dir/$pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7773 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7774
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7775 # Add non-PIC object to the list of files to remove.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7776 if test -n "$non_pic_object" &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7777 test "$non_pic_object" != none; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7778 rmfiles="$rmfiles $dir/$non_pic_object"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7779 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7780 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7781 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7782
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7783 *)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7784 if test "$mode" = clean ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7785 noexename=$name
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7786 case $file in
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7787 *.exe)
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7788 func_stripname '' '.exe' "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7789 file=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7790 func_stripname '' '.exe' "$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7791 noexename=$func_stripname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7792 # $file with .exe has already been added to rmfiles,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7793 # add $file without .exe
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7794 rmfiles="$rmfiles $file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7795 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7796 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7797 # Do a test to see if this is a libtool program.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7798 if func_ltwrapper_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7799 if func_ltwrapper_executable_p "$file"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7800 func_ltwrapper_scriptname "$file"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7801 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7802 func_source $func_ltwrapper_scriptname_result
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7803 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7804 else
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7805 relink_command=
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7806 func_source $dir/$noexename
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7807 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7808
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7809 # note $name still contains .exe if it was in $file originally
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7810 # as does the version of $file that was added into $rmfiles
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7811 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7812 if test "$fast_install" = yes && test -n "$relink_command"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7813 rmfiles="$rmfiles $objdir/lt-$name"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7814 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7815 if test "X$noexename" != "X$name" ; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7816 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7817 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7818 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7819 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7820 ;;
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7821 esac
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7822 func_show_eval "$RM $rmfiles" 'exit_status=1'
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7823 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7824 objdir="$origobjdir"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7825
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7826 # Try to remove the ${objdir}s in the directories where we deleted files
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7827 for dir in $rmdirs; do
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7828 if test -d "$dir"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7829 func_show_eval "rmdir $dir >/dev/null 2>&1"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7830 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7831 done
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7832
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7833 exit $exit_status
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7834 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7835
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7836 { test "$mode" = uninstall || test "$mode" = clean; } &&
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7837 func_mode_uninstall ${1+"$@"}
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7838
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7839 test -z "$mode" && {
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7840 help="$generic_help"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7841 func_fatal_help "you must specify a MODE"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7842 }
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7843
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7844 test -z "$exec_cmd" && \
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7845 func_fatal_help "invalid operation mode \`$mode'"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7846
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7847 if test -n "$exec_cmd"; then
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7848 eval exec "$exec_cmd"
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7849 exit $EXIT_FAILURE
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7850 fi
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7851
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7852 exit $exit_status
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7853
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7854
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7855 # The TAGs below are defined such that we never get into a situation
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7856 # in which we disable both kinds of libraries. Given conflicting
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7857 # choices, we go for a static library, that is the most portable,
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7858 # since we can't tell whether shared libraries were disabled because
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7859 # the user asked for that or because the platform doesn't support
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7860 # them. This is particularly important on AIX, because we don't
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7861 # support having both static and shared libraries enabled at the same
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7862 # time on that platform, so we default to a shared-only configuration.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7863 # If a disable-shared tag is given, we'll fallback to a static-only
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7864 # configuration. But we'll never go from static-only to shared-only.
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7865
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7866 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7867 build_libtool_libs=no
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7868 build_old_libs=yes
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7869 # ### END LIBTOOL TAG CONFIG: disable-shared
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7870
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7871 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7872 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7873 # ### END LIBTOOL TAG CONFIG: disable-static
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7874
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7875 # Local Variables:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7876 # mode:shell-script
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7877 # sh-indentation:2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7878 # End:
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7879 # vi:sw=2
1a71a031f6e7 2008-11-29 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7880