Merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-201109181907 into lp:ubuntu/oneiric/gnome-keyring
- Oneiric (11.10)
- oneiric-201109181907
- Merge into oneiric
Status: | Rejected |
---|---|
Rejected by: | James Westby |
Proposed branch: | lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-201109181907 |
Merge into: | lp:ubuntu/oneiric/gnome-keyring |
Diff against target: |
9744 lines (+9693/-0) (has conflicts) 9 files modified
.pc/.quilt_patches (+1/-0) .pc/.quilt_series (+1/-0) .pc/.version (+1/-0) .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in (+13/-0) .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in (+13/-0) .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in (+13/-0) .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in (+13/-0) .pc/99_ltmain_as-needed.patch/ltmain.sh (+9636/-0) .pc/applied-patches (+2/-0) Conflict adding file .pc. Moved existing file to .pc.moved. |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-201109181907 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+75916@code.launchpad.net |
Commit message
Description of the change
The package importer has detected a possible inconsistency between the package history in the archve and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/oneiric/gnome-keyring reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/oneiric/gnome-keyring/oneiric-201109181907. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.
If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https:/
(this is an automatically generated message)
Unmerged revisions
- 133. By Martin Pitt
-
releasing version 3.1.92-0ubuntu1
- 132. By Martin Pitt
-
apply patches
- 131. By Martin Pitt
-
* Drop 05_correct_
gpg_agent_ error_code. patch, upstream now.
* 99_ltmain_as-needed. patch: Refresh. - 130. By Martin Pitt
-
Drop 01_git_
fix_build. patch, upstream now. - 129. By Martin Pitt
-
debian/control.in: Bump libp11-kit-dev build dependency to >= 0.6
according to configure.ac. - 128. By Martin Pitt
-
new upstream release 3.1.92
- 127. By Martin Pitt
-
unapply patches
Preview Diff
1 | === added directory '.pc' |
2 | === renamed directory '.pc' => '.pc.moved' |
3 | === added file '.pc/.quilt_patches' |
4 | --- .pc/.quilt_patches 1970-01-01 00:00:00 +0000 |
5 | +++ .pc/.quilt_patches 2011-09-18 19:13:25 +0000 |
6 | @@ -0,0 +1,1 @@ |
7 | +debian/patches |
8 | |
9 | === added file '.pc/.quilt_series' |
10 | --- .pc/.quilt_series 1970-01-01 00:00:00 +0000 |
11 | +++ .pc/.quilt_series 2011-09-18 19:13:25 +0000 |
12 | @@ -0,0 +1,1 @@ |
13 | +series |
14 | |
15 | === added file '.pc/.version' |
16 | --- .pc/.version 1970-01-01 00:00:00 +0000 |
17 | +++ .pc/.version 2011-09-18 19:13:25 +0000 |
18 | @@ -0,0 +1,1 @@ |
19 | +2 |
20 | |
21 | === added directory '.pc/04_nodisplay_autostart.patch' |
22 | === added file '.pc/04_nodisplay_autostart.patch/.timestamp' |
23 | === added directory '.pc/04_nodisplay_autostart.patch/daemon' |
24 | === added file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in' |
25 | --- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in 1970-01-01 00:00:00 +0000 |
26 | +++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-gpg.desktop.in.in 2011-09-18 19:13:25 +0000 |
27 | @@ -0,0 +1,13 @@ |
28 | +[Desktop Entry] |
29 | +Type=Application |
30 | +_Name=GPG Password Agent |
31 | +_Comment=GNOME Keyring: GPG Agent |
32 | +Exec=@VALGRIND_RUN@ gnome-keyring-daemon --start --components=gpg |
33 | +OnlyShowIn=GNOME;LXDE;XFCE;Unity; |
34 | +X-GNOME-Autostart-Phase=Initialization |
35 | +X-GNOME-AutoRestart=false |
36 | +X-GNOME-Autostart-Notify=true |
37 | +X-GNOME-Bugzilla-Bugzilla=GNOME |
38 | +X-GNOME-Bugzilla-Product=gnome-keyring |
39 | +X-GNOME-Bugzilla-Component=general |
40 | +X-GNOME-Bugzilla-Version=@VERSION@ |
41 | |
42 | === added file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in' |
43 | --- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in 1970-01-01 00:00:00 +0000 |
44 | +++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-pkcs11.desktop.in.in 2011-09-18 19:13:25 +0000 |
45 | @@ -0,0 +1,13 @@ |
46 | +[Desktop Entry] |
47 | +Type=Application |
48 | +_Name=Certificate and Key Storage |
49 | +_Comment=GNOME Keyring: PKCS#11 Component |
50 | +Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=pkcs11 |
51 | +OnlyShowIn=GNOME;LXDE;XFCE;Unity; |
52 | +X-GNOME-Autostart-Phase=Initialization |
53 | +X-GNOME-AutoRestart=false |
54 | +X-GNOME-Autostart-Notify=true |
55 | +X-GNOME-Bugzilla-Bugzilla=GNOME |
56 | +X-GNOME-Bugzilla-Product=gnome-keyring |
57 | +X-GNOME-Bugzilla-Component=general |
58 | +X-GNOME-Bugzilla-Version=@VERSION@ |
59 | |
60 | === added file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in' |
61 | --- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in 1970-01-01 00:00:00 +0000 |
62 | +++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-secrets.desktop.in.in 2011-09-18 19:13:25 +0000 |
63 | @@ -0,0 +1,13 @@ |
64 | +[Desktop Entry] |
65 | +Type=Application |
66 | +_Name=Secret Storage Service |
67 | +_Comment=GNOME Keyring: Secret Service |
68 | +Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=secrets |
69 | +OnlyShowIn=GNOME;LXDE;XFCE;Unity; |
70 | +X-GNOME-Autostart-Phase=Initialization |
71 | +X-GNOME-AutoRestart=false |
72 | +X-GNOME-Autostart-Notify=true |
73 | +X-GNOME-Bugzilla-Bugzilla=GNOME |
74 | +X-GNOME-Bugzilla-Product=gnome-keyring |
75 | +X-GNOME-Bugzilla-Component=general |
76 | +X-GNOME-Bugzilla-Version=@VERSION@ |
77 | |
78 | === added file '.pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in' |
79 | --- .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in 1970-01-01 00:00:00 +0000 |
80 | +++ .pc/04_nodisplay_autostart.patch/daemon/gnome-keyring-ssh.desktop.in.in 2011-09-18 19:13:25 +0000 |
81 | @@ -0,0 +1,13 @@ |
82 | +[Desktop Entry] |
83 | +Type=Application |
84 | +_Name=SSH Key Agent |
85 | +_Comment=GNOME Keyring: SSH Agent |
86 | +Exec=@VALGRIND_RUN@@BINDIR@/gnome-keyring-daemon --start --components=ssh |
87 | +OnlyShowIn=GNOME;LXDE;XFCE;Unity; |
88 | +X-GNOME-Autostart-Phase=Initialization |
89 | +X-GNOME-AutoRestart=false |
90 | +X-GNOME-Autostart-Notify=true |
91 | +X-GNOME-Bugzilla-Bugzilla=GNOME |
92 | +X-GNOME-Bugzilla-Product=gnome-keyring |
93 | +X-GNOME-Bugzilla-Component=general |
94 | +X-GNOME-Bugzilla-Version=@VERSION@ |
95 | |
96 | === added directory '.pc/99_ltmain_as-needed.patch' |
97 | === added file '.pc/99_ltmain_as-needed.patch/.timestamp' |
98 | === added file '.pc/99_ltmain_as-needed.patch/ltmain.sh' |
99 | --- .pc/99_ltmain_as-needed.patch/ltmain.sh 1970-01-01 00:00:00 +0000 |
100 | +++ .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-09-18 19:13:25 +0000 |
101 | @@ -0,0 +1,9636 @@ |
102 | + |
103 | +# libtool (GNU libtool) 2.4 |
104 | +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
105 | + |
106 | +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
107 | +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
108 | +# This is free software; see the source for copying conditions. There is NO |
109 | +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
110 | + |
111 | +# GNU Libtool is free software; you can redistribute it and/or modify |
112 | +# it under the terms of the GNU General Public License as published by |
113 | +# the Free Software Foundation; either version 2 of the License, or |
114 | +# (at your option) any later version. |
115 | +# |
116 | +# As a special exception to the GNU General Public License, |
117 | +# if you distribute this file as part of a program or library that |
118 | +# is built using GNU Libtool, you may include this file under the |
119 | +# same distribution terms that you use for the rest of that program. |
120 | +# |
121 | +# GNU Libtool is distributed in the hope that it will be useful, but |
122 | +# WITHOUT ANY WARRANTY; without even the implied warranty of |
123 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
124 | +# General Public License for more details. |
125 | +# |
126 | +# You should have received a copy of the GNU General Public License |
127 | +# along with GNU Libtool; see the file COPYING. If not, a copy |
128 | +# can be downloaded from http://www.gnu.org/licenses/gpl.html, |
129 | +# or obtained by writing to the Free Software Foundation, Inc., |
130 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
131 | + |
132 | +# Usage: $progname [OPTION]... [MODE-ARG]... |
133 | +# |
134 | +# Provide generalized library-building support services. |
135 | +# |
136 | +# --config show all configuration variables |
137 | +# --debug enable verbose shell tracing |
138 | +# -n, --dry-run display commands without modifying any files |
139 | +# --features display basic configuration information and exit |
140 | +# --mode=MODE use operation mode MODE |
141 | +# --preserve-dup-deps don't remove duplicate dependency libraries |
142 | +# --quiet, --silent don't print informational messages |
143 | +# --no-quiet, --no-silent |
144 | +# print informational messages (default) |
145 | +# --tag=TAG use configuration variables from tag TAG |
146 | +# -v, --verbose print more informational messages than default |
147 | +# --no-verbose don't print the extra informational messages |
148 | +# --version print version information |
149 | +# -h, --help, --help-all print short, long, or detailed help message |
150 | +# |
151 | +# MODE must be one of the following: |
152 | +# |
153 | +# clean remove files from the build directory |
154 | +# compile compile a source file into a libtool object |
155 | +# execute automatically set library path, then run a program |
156 | +# finish complete the installation of libtool libraries |
157 | +# install install libraries or executables |
158 | +# link create a library or an executable |
159 | +# uninstall remove libraries from an installed directory |
160 | +# |
161 | +# MODE-ARGS vary depending on the MODE. When passed as first option, |
162 | +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. |
163 | +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
164 | +# |
165 | +# When reporting a bug, please describe a test case to reproduce it and |
166 | +# include the following information: |
167 | +# |
168 | +# host-triplet: $host |
169 | +# shell: $SHELL |
170 | +# compiler: $LTCC |
171 | +# compiler flags: $LTCFLAGS |
172 | +# linker: $LD (gnu? $with_gnu_ld) |
173 | +# $progname: (GNU libtool) 2.4 |
174 | +# automake: $automake_version |
175 | +# autoconf: $autoconf_version |
176 | +# |
177 | +# Report bugs to <bug-libtool@gnu.org>. |
178 | +# GNU libtool home page: <http://www.gnu.org/software/libtool/>. |
179 | +# General help using GNU software: <http://www.gnu.org/gethelp/>. |
180 | + |
181 | +PROGRAM=libtool |
182 | +PACKAGE=libtool |
183 | +VERSION=2.4 |
184 | +TIMESTAMP="" |
185 | +package_revision=1.3293 |
186 | + |
187 | +# Be Bourne compatible |
188 | +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
189 | + emulate sh |
190 | + NULLCMD=: |
191 | + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
192 | + # is contrary to our usage. Disable this feature. |
193 | + alias -g '${1+"$@"}'='"$@"' |
194 | + setopt NO_GLOB_SUBST |
195 | +else |
196 | + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
197 | +fi |
198 | +BIN_SH=xpg4; export BIN_SH # for Tru64 |
199 | +DUALCASE=1; export DUALCASE # for MKS sh |
200 | + |
201 | +# A function that is used when there is no print builtin or printf. |
202 | +func_fallback_echo () |
203 | +{ |
204 | + eval 'cat <<_LTECHO_EOF |
205 | +$1 |
206 | +_LTECHO_EOF' |
207 | +} |
208 | + |
209 | +# NLS nuisances: We save the old values to restore during execute mode. |
210 | +lt_user_locale= |
211 | +lt_safe_locale= |
212 | +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
213 | +do |
214 | + eval "if test \"\${$lt_var+set}\" = set; then |
215 | + save_$lt_var=\$$lt_var |
216 | + $lt_var=C |
217 | + export $lt_var |
218 | + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
219 | + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
220 | + fi" |
221 | +done |
222 | +LC_ALL=C |
223 | +LANGUAGE=C |
224 | +export LANGUAGE LC_ALL |
225 | + |
226 | +$lt_unset CDPATH |
227 | + |
228 | + |
229 | +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
230 | +# is ksh but when the shell is invoked as "sh" and the current value of |
231 | +# the _XPG environment variable is not equal to 1 (one), the special |
232 | +# positional parameter $0, within a function call, is the name of the |
233 | +# function. |
234 | +progpath="$0" |
235 | + |
236 | + |
237 | + |
238 | +: ${CP="cp -f"} |
239 | +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} |
240 | +: ${EGREP="/bin/grep -E"} |
241 | +: ${FGREP="/bin/grep -F"} |
242 | +: ${GREP="/bin/grep"} |
243 | +: ${LN_S="ln -s"} |
244 | +: ${MAKE="make"} |
245 | +: ${MKDIR="mkdir"} |
246 | +: ${MV="mv -f"} |
247 | +: ${RM="rm -f"} |
248 | +: ${SED="/bin/sed"} |
249 | +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
250 | +: ${Xsed="$SED -e 1s/^X//"} |
251 | + |
252 | +# Global variables: |
253 | +EXIT_SUCCESS=0 |
254 | +EXIT_FAILURE=1 |
255 | +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
256 | +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
257 | + |
258 | +exit_status=$EXIT_SUCCESS |
259 | + |
260 | +# Make sure IFS has a sensible default |
261 | +lt_nl=' |
262 | +' |
263 | +IFS=" $lt_nl" |
264 | + |
265 | +dirname="s,/[^/]*$,," |
266 | +basename="s,^.*/,," |
267 | + |
268 | +# func_dirname file append nondir_replacement |
269 | +# Compute the dirname of FILE. If nonempty, add APPEND to the result, |
270 | +# otherwise set result to NONDIR_REPLACEMENT. |
271 | +func_dirname () |
272 | +{ |
273 | + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` |
274 | + if test "X$func_dirname_result" = "X${1}"; then |
275 | + func_dirname_result="${3}" |
276 | + else |
277 | + func_dirname_result="$func_dirname_result${2}" |
278 | + fi |
279 | +} # func_dirname may be replaced by extended shell implementation |
280 | + |
281 | + |
282 | +# func_basename file |
283 | +func_basename () |
284 | +{ |
285 | + func_basename_result=`$ECHO "${1}" | $SED "$basename"` |
286 | +} # func_basename may be replaced by extended shell implementation |
287 | + |
288 | + |
289 | +# func_dirname_and_basename file append nondir_replacement |
290 | +# perform func_basename and func_dirname in a single function |
291 | +# call: |
292 | +# dirname: Compute the dirname of FILE. If nonempty, |
293 | +# add APPEND to the result, otherwise set result |
294 | +# to NONDIR_REPLACEMENT. |
295 | +# value returned in "$func_dirname_result" |
296 | +# basename: Compute filename of FILE. |
297 | +# value retuned in "$func_basename_result" |
298 | +# Implementation must be kept synchronized with func_dirname |
299 | +# and func_basename. For efficiency, we do not delegate to |
300 | +# those functions but instead duplicate the functionality here. |
301 | +func_dirname_and_basename () |
302 | +{ |
303 | + # Extract subdirectory from the argument. |
304 | + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` |
305 | + if test "X$func_dirname_result" = "X${1}"; then |
306 | + func_dirname_result="${3}" |
307 | + else |
308 | + func_dirname_result="$func_dirname_result${2}" |
309 | + fi |
310 | + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` |
311 | +} # func_dirname_and_basename may be replaced by extended shell implementation |
312 | + |
313 | + |
314 | +# func_stripname prefix suffix name |
315 | +# strip PREFIX and SUFFIX off of NAME. |
316 | +# PREFIX and SUFFIX must not contain globbing or regex special |
317 | +# characters, hashes, percent signs, but SUFFIX may contain a leading |
318 | +# dot (in which case that matches only a dot). |
319 | +# func_strip_suffix prefix name |
320 | +func_stripname () |
321 | +{ |
322 | + case ${2} in |
323 | + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; |
324 | + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; |
325 | + esac |
326 | +} # func_stripname may be replaced by extended shell implementation |
327 | + |
328 | + |
329 | +# These SED scripts presuppose an absolute path with a trailing slash. |
330 | +pathcar='s,^/\([^/]*\).*$,\1,' |
331 | +pathcdr='s,^/[^/]*,,' |
332 | +removedotparts=':dotsl |
333 | + s@/\./@/@g |
334 | + t dotsl |
335 | + s,/\.$,/,' |
336 | +collapseslashes='s@/\{1,\}@/@g' |
337 | +finalslash='s,/*$,/,' |
338 | + |
339 | +# func_normal_abspath PATH |
340 | +# Remove doubled-up and trailing slashes, "." path components, |
341 | +# and cancel out any ".." path components in PATH after making |
342 | +# it an absolute path. |
343 | +# value returned in "$func_normal_abspath_result" |
344 | +func_normal_abspath () |
345 | +{ |
346 | + # Start from root dir and reassemble the path. |
347 | + func_normal_abspath_result= |
348 | + func_normal_abspath_tpath=$1 |
349 | + func_normal_abspath_altnamespace= |
350 | + case $func_normal_abspath_tpath in |
351 | + "") |
352 | + # Empty path, that just means $cwd. |
353 | + func_stripname '' '/' "`pwd`" |
354 | + func_normal_abspath_result=$func_stripname_result |
355 | + return |
356 | + ;; |
357 | + # The next three entries are used to spot a run of precisely |
358 | + # two leading slashes without using negated character classes; |
359 | + # we take advantage of case's first-match behaviour. |
360 | + ///*) |
361 | + # Unusual form of absolute path, do nothing. |
362 | + ;; |
363 | + //*) |
364 | + # Not necessarily an ordinary path; POSIX reserves leading '//' |
365 | + # and for example Cygwin uses it to access remote file shares |
366 | + # over CIFS/SMB, so we conserve a leading double slash if found. |
367 | + func_normal_abspath_altnamespace=/ |
368 | + ;; |
369 | + /*) |
370 | + # Absolute path, do nothing. |
371 | + ;; |
372 | + *) |
373 | + # Relative path, prepend $cwd. |
374 | + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
375 | + ;; |
376 | + esac |
377 | + # Cancel out all the simple stuff to save iterations. We also want |
378 | + # the path to end with a slash for ease of parsing, so make sure |
379 | + # there is one (and only one) here. |
380 | + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
381 | + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
382 | + while :; do |
383 | + # Processed it all yet? |
384 | + if test "$func_normal_abspath_tpath" = / ; then |
385 | + # If we ascended to the root using ".." the result may be empty now. |
386 | + if test -z "$func_normal_abspath_result" ; then |
387 | + func_normal_abspath_result=/ |
388 | + fi |
389 | + break |
390 | + fi |
391 | + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
392 | + -e "$pathcar"` |
393 | + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
394 | + -e "$pathcdr"` |
395 | + # Figure out what to do with it |
396 | + case $func_normal_abspath_tcomponent in |
397 | + "") |
398 | + # Trailing empty path component, ignore it. |
399 | + ;; |
400 | + ..) |
401 | + # Parent dir; strip last assembled component from result. |
402 | + func_dirname "$func_normal_abspath_result" |
403 | + func_normal_abspath_result=$func_dirname_result |
404 | + ;; |
405 | + *) |
406 | + # Actual path component, append it. |
407 | + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
408 | + ;; |
409 | + esac |
410 | + done |
411 | + # Restore leading double-slash if one was found on entry. |
412 | + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
413 | +} |
414 | + |
415 | +# func_relative_path SRCDIR DSTDIR |
416 | +# generates a relative path from SRCDIR to DSTDIR, with a trailing |
417 | +# slash if non-empty, suitable for immediately appending a filename |
418 | +# without needing to append a separator. |
419 | +# value returned in "$func_relative_path_result" |
420 | +func_relative_path () |
421 | +{ |
422 | + func_relative_path_result= |
423 | + func_normal_abspath "$1" |
424 | + func_relative_path_tlibdir=$func_normal_abspath_result |
425 | + func_normal_abspath "$2" |
426 | + func_relative_path_tbindir=$func_normal_abspath_result |
427 | + |
428 | + # Ascend the tree starting from libdir |
429 | + while :; do |
430 | + # check if we have found a prefix of bindir |
431 | + case $func_relative_path_tbindir in |
432 | + $func_relative_path_tlibdir) |
433 | + # found an exact match |
434 | + func_relative_path_tcancelled= |
435 | + break |
436 | + ;; |
437 | + $func_relative_path_tlibdir*) |
438 | + # found a matching prefix |
439 | + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
440 | + func_relative_path_tcancelled=$func_stripname_result |
441 | + if test -z "$func_relative_path_result"; then |
442 | + func_relative_path_result=. |
443 | + fi |
444 | + break |
445 | + ;; |
446 | + *) |
447 | + func_dirname $func_relative_path_tlibdir |
448 | + func_relative_path_tlibdir=${func_dirname_result} |
449 | + if test "x$func_relative_path_tlibdir" = x ; then |
450 | + # Have to descend all the way to the root! |
451 | + func_relative_path_result=../$func_relative_path_result |
452 | + func_relative_path_tcancelled=$func_relative_path_tbindir |
453 | + break |
454 | + fi |
455 | + func_relative_path_result=../$func_relative_path_result |
456 | + ;; |
457 | + esac |
458 | + done |
459 | + |
460 | + # Now calculate path; take care to avoid doubling-up slashes. |
461 | + func_stripname '' '/' "$func_relative_path_result" |
462 | + func_relative_path_result=$func_stripname_result |
463 | + func_stripname '/' '/' "$func_relative_path_tcancelled" |
464 | + if test "x$func_stripname_result" != x ; then |
465 | + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
466 | + fi |
467 | + |
468 | + # Normalisation. If bindir is libdir, return empty string, |
469 | + # else relative path ending with a slash; either way, target |
470 | + # file name can be directly appended. |
471 | + if test ! -z "$func_relative_path_result"; then |
472 | + func_stripname './' '' "$func_relative_path_result/" |
473 | + func_relative_path_result=$func_stripname_result |
474 | + fi |
475 | +} |
476 | + |
477 | +# The name of this program: |
478 | +func_dirname_and_basename "$progpath" |
479 | +progname=$func_basename_result |
480 | + |
481 | +# Make sure we have an absolute path for reexecution: |
482 | +case $progpath in |
483 | + [\\/]*|[A-Za-z]:\\*) ;; |
484 | + *[\\/]*) |
485 | + progdir=$func_dirname_result |
486 | + progdir=`cd "$progdir" && pwd` |
487 | + progpath="$progdir/$progname" |
488 | + ;; |
489 | + *) |
490 | + save_IFS="$IFS" |
491 | + IFS=: |
492 | + for progdir in $PATH; do |
493 | + IFS="$save_IFS" |
494 | + test -x "$progdir/$progname" && break |
495 | + done |
496 | + IFS="$save_IFS" |
497 | + test -n "$progdir" || progdir=`pwd` |
498 | + progpath="$progdir/$progname" |
499 | + ;; |
500 | +esac |
501 | + |
502 | +# Sed substitution that helps us do robust quoting. It backslashifies |
503 | +# metacharacters that are still active within double-quoted strings. |
504 | +Xsed="${SED}"' -e 1s/^X//' |
505 | +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
506 | + |
507 | +# Same as above, but do not quote variable references. |
508 | +double_quote_subst='s/\(["`\\]\)/\\\1/g' |
509 | + |
510 | +# Sed substitution that turns a string into a regex matching for the |
511 | +# string literally. |
512 | +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' |
513 | + |
514 | +# Sed substitution that converts a w32 file name or path |
515 | +# which contains forward slashes, into one that contains |
516 | +# (escaped) backslashes. A very naive implementation. |
517 | +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
518 | + |
519 | +# Re-`\' parameter expansions in output of double_quote_subst that were |
520 | +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
521 | +# in input to double_quote_subst, that '$' was protected from expansion. |
522 | +# Since each input `\' is now two `\'s, look for any number of runs of |
523 | +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
524 | +bs='\\' |
525 | +bs2='\\\\' |
526 | +bs4='\\\\\\\\' |
527 | +dollar='\$' |
528 | +sed_double_backslash="\ |
529 | + s/$bs4/&\\ |
530 | +/g |
531 | + s/^$bs2$dollar/$bs&/ |
532 | + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
533 | + s/\n//g" |
534 | + |
535 | +# Standard options: |
536 | +opt_dry_run=false |
537 | +opt_help=false |
538 | +opt_quiet=false |
539 | +opt_verbose=false |
540 | +opt_warning=: |
541 | + |
542 | +# func_echo arg... |
543 | +# Echo program name prefixed message, along with the current mode |
544 | +# name if it has been set yet. |
545 | +func_echo () |
546 | +{ |
547 | + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" |
548 | +} |
549 | + |
550 | +# func_verbose arg... |
551 | +# Echo program name prefixed message in verbose mode only. |
552 | +func_verbose () |
553 | +{ |
554 | + $opt_verbose && func_echo ${1+"$@"} |
555 | + |
556 | + # A bug in bash halts the script if the last line of a function |
557 | + # fails when set -e is in force, so we need another command to |
558 | + # work around that: |
559 | + : |
560 | +} |
561 | + |
562 | +# func_echo_all arg... |
563 | +# Invoke $ECHO with all args, space-separated. |
564 | +func_echo_all () |
565 | +{ |
566 | + $ECHO "$*" |
567 | +} |
568 | + |
569 | +# func_error arg... |
570 | +# Echo program name prefixed message to standard error. |
571 | +func_error () |
572 | +{ |
573 | + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 |
574 | +} |
575 | + |
576 | +# func_warning arg... |
577 | +# Echo program name prefixed warning message to standard error. |
578 | +func_warning () |
579 | +{ |
580 | + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 |
581 | + |
582 | + # bash bug again: |
583 | + : |
584 | +} |
585 | + |
586 | +# func_fatal_error arg... |
587 | +# Echo program name prefixed message to standard error, and exit. |
588 | +func_fatal_error () |
589 | +{ |
590 | + func_error ${1+"$@"} |
591 | + exit $EXIT_FAILURE |
592 | +} |
593 | + |
594 | +# func_fatal_help arg... |
595 | +# Echo program name prefixed message to standard error, followed by |
596 | +# a help hint, and exit. |
597 | +func_fatal_help () |
598 | +{ |
599 | + func_error ${1+"$@"} |
600 | + func_fatal_error "$help" |
601 | +} |
602 | +help="Try \`$progname --help' for more information." ## default |
603 | + |
604 | + |
605 | +# func_grep expression filename |
606 | +# Check whether EXPRESSION matches any line of FILENAME, without output. |
607 | +func_grep () |
608 | +{ |
609 | + $GREP "$1" "$2" >/dev/null 2>&1 |
610 | +} |
611 | + |
612 | + |
613 | +# func_mkdir_p directory-path |
614 | +# Make sure the entire path to DIRECTORY-PATH is available. |
615 | +func_mkdir_p () |
616 | +{ |
617 | + my_directory_path="$1" |
618 | + my_dir_list= |
619 | + |
620 | + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
621 | + |
622 | + # Protect directory names starting with `-' |
623 | + case $my_directory_path in |
624 | + -*) my_directory_path="./$my_directory_path" ;; |
625 | + esac |
626 | + |
627 | + # While some portion of DIR does not yet exist... |
628 | + while test ! -d "$my_directory_path"; do |
629 | + # ...make a list in topmost first order. Use a colon delimited |
630 | + # list incase some portion of path contains whitespace. |
631 | + my_dir_list="$my_directory_path:$my_dir_list" |
632 | + |
633 | + # If the last portion added has no slash in it, the list is done |
634 | + case $my_directory_path in */*) ;; *) break ;; esac |
635 | + |
636 | + # ...otherwise throw away the child directory and loop |
637 | + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
638 | + done |
639 | + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
640 | + |
641 | + save_mkdir_p_IFS="$IFS"; IFS=':' |
642 | + for my_dir in $my_dir_list; do |
643 | + IFS="$save_mkdir_p_IFS" |
644 | + # mkdir can fail with a `File exist' error if two processes |
645 | + # try to create one of the directories concurrently. Don't |
646 | + # stop in that case! |
647 | + $MKDIR "$my_dir" 2>/dev/null || : |
648 | + done |
649 | + IFS="$save_mkdir_p_IFS" |
650 | + |
651 | + # Bail out if we (or some other process) failed to create a directory. |
652 | + test -d "$my_directory_path" || \ |
653 | + func_fatal_error "Failed to create \`$1'" |
654 | + fi |
655 | +} |
656 | + |
657 | + |
658 | +# func_mktempdir [string] |
659 | +# Make a temporary directory that won't clash with other running |
660 | +# libtool processes, and avoids race conditions if possible. If |
661 | +# given, STRING is the basename for that directory. |
662 | +func_mktempdir () |
663 | +{ |
664 | + my_template="${TMPDIR-/tmp}/${1-$progname}" |
665 | + |
666 | + if test "$opt_dry_run" = ":"; then |
667 | + # Return a directory name, but don't create it in dry-run mode |
668 | + my_tmpdir="${my_template}-$$" |
669 | + else |
670 | + |
671 | + # If mktemp works, use that first and foremost |
672 | + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
673 | + |
674 | + if test ! -d "$my_tmpdir"; then |
675 | + # Failing that, at least try and use $RANDOM to avoid a race |
676 | + my_tmpdir="${my_template}-${RANDOM-0}$$" |
677 | + |
678 | + save_mktempdir_umask=`umask` |
679 | + umask 0077 |
680 | + $MKDIR "$my_tmpdir" |
681 | + umask $save_mktempdir_umask |
682 | + fi |
683 | + |
684 | + # If we're not in dry-run mode, bomb out on failure |
685 | + test -d "$my_tmpdir" || \ |
686 | + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
687 | + fi |
688 | + |
689 | + $ECHO "$my_tmpdir" |
690 | +} |
691 | + |
692 | + |
693 | +# func_quote_for_eval arg |
694 | +# Aesthetically quote ARG to be evaled later. |
695 | +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
696 | +# is double-quoted, suitable for a subsequent eval, whereas |
697 | +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
698 | +# which are still active within double quotes backslashified. |
699 | +func_quote_for_eval () |
700 | +{ |
701 | + case $1 in |
702 | + *[\\\`\"\$]*) |
703 | + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
704 | + *) |
705 | + func_quote_for_eval_unquoted_result="$1" ;; |
706 | + esac |
707 | + |
708 | + case $func_quote_for_eval_unquoted_result in |
709 | + # Double-quote args containing shell metacharacters to delay |
710 | + # word splitting, command substitution and and variable |
711 | + # expansion for a subsequent eval. |
712 | + # Many Bourne shells cannot handle close brackets correctly |
713 | + # in scan sets, so we specify it separately. |
714 | + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
715 | + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
716 | + ;; |
717 | + *) |
718 | + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
719 | + esac |
720 | +} |
721 | + |
722 | + |
723 | +# func_quote_for_expand arg |
724 | +# Aesthetically quote ARG to be evaled later; same as above, |
725 | +# but do not quote variable references. |
726 | +func_quote_for_expand () |
727 | +{ |
728 | + case $1 in |
729 | + *[\\\`\"]*) |
730 | + my_arg=`$ECHO "$1" | $SED \ |
731 | + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
732 | + *) |
733 | + my_arg="$1" ;; |
734 | + esac |
735 | + |
736 | + case $my_arg in |
737 | + # Double-quote args containing shell metacharacters to delay |
738 | + # word splitting and command substitution for a subsequent eval. |
739 | + # Many Bourne shells cannot handle close brackets correctly |
740 | + # in scan sets, so we specify it separately. |
741 | + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
742 | + my_arg="\"$my_arg\"" |
743 | + ;; |
744 | + esac |
745 | + |
746 | + func_quote_for_expand_result="$my_arg" |
747 | +} |
748 | + |
749 | + |
750 | +# func_show_eval cmd [fail_exp] |
751 | +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
752 | +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
753 | +# is given, then evaluate it. |
754 | +func_show_eval () |
755 | +{ |
756 | + my_cmd="$1" |
757 | + my_fail_exp="${2-:}" |
758 | + |
759 | + ${opt_silent-false} || { |
760 | + func_quote_for_expand "$my_cmd" |
761 | + eval "func_echo $func_quote_for_expand_result" |
762 | + } |
763 | + |
764 | + if ${opt_dry_run-false}; then :; else |
765 | + eval "$my_cmd" |
766 | + my_status=$? |
767 | + if test "$my_status" -eq 0; then :; else |
768 | + eval "(exit $my_status); $my_fail_exp" |
769 | + fi |
770 | + fi |
771 | +} |
772 | + |
773 | + |
774 | +# func_show_eval_locale cmd [fail_exp] |
775 | +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
776 | +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
777 | +# is given, then evaluate it. Use the saved locale for evaluation. |
778 | +func_show_eval_locale () |
779 | +{ |
780 | + my_cmd="$1" |
781 | + my_fail_exp="${2-:}" |
782 | + |
783 | + ${opt_silent-false} || { |
784 | + func_quote_for_expand "$my_cmd" |
785 | + eval "func_echo $func_quote_for_expand_result" |
786 | + } |
787 | + |
788 | + if ${opt_dry_run-false}; then :; else |
789 | + eval "$lt_user_locale |
790 | + $my_cmd" |
791 | + my_status=$? |
792 | + eval "$lt_safe_locale" |
793 | + if test "$my_status" -eq 0; then :; else |
794 | + eval "(exit $my_status); $my_fail_exp" |
795 | + fi |
796 | + fi |
797 | +} |
798 | + |
799 | +# func_tr_sh |
800 | +# Turn $1 into a string suitable for a shell variable name. |
801 | +# Result is stored in $func_tr_sh_result. All characters |
802 | +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, |
803 | +# if $1 begins with a digit, a '_' is prepended as well. |
804 | +func_tr_sh () |
805 | +{ |
806 | + case $1 in |
807 | + [0-9]* | *[!a-zA-Z0-9_]*) |
808 | + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` |
809 | + ;; |
810 | + * ) |
811 | + func_tr_sh_result=$1 |
812 | + ;; |
813 | + esac |
814 | +} |
815 | + |
816 | + |
817 | +# func_version |
818 | +# Echo version message to standard output and exit. |
819 | +func_version () |
820 | +{ |
821 | + $opt_debug |
822 | + |
823 | + $SED -n '/(C)/!b go |
824 | + :more |
825 | + /\./!{ |
826 | + N |
827 | + s/\n# / / |
828 | + b more |
829 | + } |
830 | + :go |
831 | + /^# '$PROGRAM' (GNU /,/# warranty; / { |
832 | + s/^# // |
833 | + s/^# *$// |
834 | + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
835 | + p |
836 | + }' < "$progpath" |
837 | + exit $? |
838 | +} |
839 | + |
840 | +# func_usage |
841 | +# Echo short help message to standard output and exit. |
842 | +func_usage () |
843 | +{ |
844 | + $opt_debug |
845 | + |
846 | + $SED -n '/^# Usage:/,/^# *.*--help/ { |
847 | + s/^# // |
848 | + s/^# *$// |
849 | + s/\$progname/'$progname'/ |
850 | + p |
851 | + }' < "$progpath" |
852 | + echo |
853 | + $ECHO "run \`$progname --help | more' for full usage" |
854 | + exit $? |
855 | +} |
856 | + |
857 | +# func_help [NOEXIT] |
858 | +# Echo long help message to standard output and exit, |
859 | +# unless 'noexit' is passed as argument. |
860 | +func_help () |
861 | +{ |
862 | + $opt_debug |
863 | + |
864 | + $SED -n '/^# Usage:/,/# Report bugs to/ { |
865 | |
866 | + s/^# // |
867 | + s/^# *$// |
868 | + s*\$progname*'$progname'* |
869 | + s*\$host*'"$host"'* |
870 | + s*\$SHELL*'"$SHELL"'* |
871 | + s*\$LTCC*'"$LTCC"'* |
872 | + s*\$LTCFLAGS*'"$LTCFLAGS"'* |
873 | + s*\$LD*'"$LD"'* |
874 | + s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
875 | + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
876 | + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
877 | + p |
878 | + d |
879 | + } |
880 | + /^# .* home page:/b print |
881 | + /^# General help using/b print |
882 | + ' < "$progpath" |
883 | + ret=$? |
884 | + if test -z "$1"; then |
885 | + exit $ret |
886 | + fi |
887 | +} |
888 | + |
889 | +# func_missing_arg argname |
890 | +# Echo program name prefixed message to standard error and set global |
891 | +# exit_cmd. |
892 | +func_missing_arg () |
893 | +{ |
894 | + $opt_debug |
895 | + |
896 | + func_error "missing argument for $1." |
897 | + exit_cmd=exit |
898 | +} |
899 | + |
900 | + |
901 | +# func_split_short_opt shortopt |
902 | +# Set func_split_short_opt_name and func_split_short_opt_arg shell |
903 | +# variables after splitting SHORTOPT after the 2nd character. |
904 | +func_split_short_opt () |
905 | +{ |
906 | + my_sed_short_opt='1s/^\(..\).*$/\1/;q' |
907 | + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' |
908 | + |
909 | + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` |
910 | + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` |
911 | +} # func_split_short_opt may be replaced by extended shell implementation |
912 | + |
913 | + |
914 | +# func_split_long_opt longopt |
915 | +# Set func_split_long_opt_name and func_split_long_opt_arg shell |
916 | +# variables after splitting LONGOPT at the `=' sign. |
917 | +func_split_long_opt () |
918 | +{ |
919 | + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' |
920 | + my_sed_long_arg='1s/^--[^=]*=//' |
921 | + |
922 | + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` |
923 | + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` |
924 | +} # func_split_long_opt may be replaced by extended shell implementation |
925 | + |
926 | +exit_cmd=: |
927 | + |
928 | + |
929 | + |
930 | + |
931 | + |
932 | +magic="%%%MAGIC variable%%%" |
933 | +magic_exe="%%%MAGIC EXE variable%%%" |
934 | + |
935 | +# Global variables. |
936 | +nonopt= |
937 | +preserve_args= |
938 | +lo2o="s/\\.lo\$/.${objext}/" |
939 | +o2lo="s/\\.${objext}\$/.lo/" |
940 | +extracted_archives= |
941 | +extracted_serial=0 |
942 | + |
943 | +# If this variable is set in any of the actions, the command in it |
944 | +# will be execed at the end. This prevents here-documents from being |
945 | +# left over by shells. |
946 | +exec_cmd= |
947 | + |
948 | +# func_append var value |
949 | +# Append VALUE to the end of shell variable VAR. |
950 | +func_append () |
951 | +{ |
952 | + eval "${1}=\$${1}\${2}" |
953 | +} # func_append may be replaced by extended shell implementation |
954 | + |
955 | +# func_append_quoted var value |
956 | +# Quote VALUE and append to the end of shell variable VAR, separated |
957 | +# by a space. |
958 | +func_append_quoted () |
959 | +{ |
960 | + func_quote_for_eval "${2}" |
961 | + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" |
962 | +} # func_append_quoted may be replaced by extended shell implementation |
963 | + |
964 | + |
965 | +# func_arith arithmetic-term... |
966 | +func_arith () |
967 | +{ |
968 | + func_arith_result=`expr "${@}"` |
969 | +} # func_arith may be replaced by extended shell implementation |
970 | + |
971 | + |
972 | +# func_len string |
973 | +# STRING may not start with a hyphen. |
974 | +func_len () |
975 | +{ |
976 | + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` |
977 | +} # func_len may be replaced by extended shell implementation |
978 | + |
979 | + |
980 | +# func_lo2o object |
981 | +func_lo2o () |
982 | +{ |
983 | + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` |
984 | +} # func_lo2o may be replaced by extended shell implementation |
985 | + |
986 | + |
987 | +# func_xform libobj-or-source |
988 | +func_xform () |
989 | +{ |
990 | + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` |
991 | +} # func_xform may be replaced by extended shell implementation |
992 | + |
993 | + |
994 | +# func_fatal_configuration arg... |
995 | +# Echo program name prefixed message to standard error, followed by |
996 | +# a configuration failure hint, and exit. |
997 | +func_fatal_configuration () |
998 | +{ |
999 | + func_error ${1+"$@"} |
1000 | + func_error "See the $PACKAGE documentation for more information." |
1001 | + func_fatal_error "Fatal configuration error." |
1002 | +} |
1003 | + |
1004 | + |
1005 | +# func_config |
1006 | +# Display the configuration for all the tags in this script. |
1007 | +func_config () |
1008 | +{ |
1009 | + re_begincf='^# ### BEGIN LIBTOOL' |
1010 | + re_endcf='^# ### END LIBTOOL' |
1011 | + |
1012 | + # Default configuration. |
1013 | + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
1014 | + |
1015 | + # Now print the configurations for the tags. |
1016 | + for tagname in $taglist; do |
1017 | + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
1018 | + done |
1019 | + |
1020 | + exit $? |
1021 | +} |
1022 | + |
1023 | +# func_features |
1024 | +# Display the features supported by this script. |
1025 | +func_features () |
1026 | +{ |
1027 | + echo "host: $host" |
1028 | + if test "$build_libtool_libs" = yes; then |
1029 | + echo "enable shared libraries" |
1030 | + else |
1031 | + echo "disable shared libraries" |
1032 | + fi |
1033 | + if test "$build_old_libs" = yes; then |
1034 | + echo "enable static libraries" |
1035 | + else |
1036 | + echo "disable static libraries" |
1037 | + fi |
1038 | + |
1039 | + exit $? |
1040 | +} |
1041 | + |
1042 | +# func_enable_tag tagname |
1043 | +# Verify that TAGNAME is valid, and either flag an error and exit, or |
1044 | +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
1045 | +# variable here. |
1046 | +func_enable_tag () |
1047 | +{ |
1048 | + # Global variable: |
1049 | + tagname="$1" |
1050 | + |
1051 | + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
1052 | + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
1053 | + sed_extractcf="/$re_begincf/,/$re_endcf/p" |
1054 | + |
1055 | + # Validate tagname. |
1056 | + case $tagname in |
1057 | + *[!-_A-Za-z0-9,/]*) |
1058 | + func_fatal_error "invalid tag name: $tagname" |
1059 | + ;; |
1060 | + esac |
1061 | + |
1062 | + # Don't test for the "default" C tag, as we know it's |
1063 | + # there but not specially marked. |
1064 | + case $tagname in |
1065 | + CC) ;; |
1066 | + *) |
1067 | + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
1068 | + taglist="$taglist $tagname" |
1069 | + |
1070 | + # Evaluate the configuration. Be careful to quote the path |
1071 | + # and the sed script, to avoid splitting on whitespace, but |
1072 | + # also don't use non-portable quotes within backquotes within |
1073 | + # quotes we have to do it in 2 steps: |
1074 | + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
1075 | + eval "$extractedcf" |
1076 | + else |
1077 | + func_error "ignoring unknown tag $tagname" |
1078 | + fi |
1079 | + ;; |
1080 | + esac |
1081 | +} |
1082 | + |
1083 | +# func_check_version_match |
1084 | +# Ensure that we are using m4 macros, and libtool script from the same |
1085 | +# release of libtool. |
1086 | +func_check_version_match () |
1087 | +{ |
1088 | + if test "$package_revision" != "$macro_revision"; then |
1089 | + if test "$VERSION" != "$macro_version"; then |
1090 | + if test -z "$macro_version"; then |
1091 | + cat >&2 <<_LT_EOF |
1092 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
1093 | +$progname: definition of this LT_INIT comes from an older release. |
1094 | +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
1095 | +$progname: and run autoconf again. |
1096 | +_LT_EOF |
1097 | + else |
1098 | + cat >&2 <<_LT_EOF |
1099 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
1100 | +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
1101 | +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
1102 | +$progname: and run autoconf again. |
1103 | +_LT_EOF |
1104 | + fi |
1105 | + else |
1106 | + cat >&2 <<_LT_EOF |
1107 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
1108 | +$progname: but the definition of this LT_INIT comes from revision $macro_revision. |
1109 | +$progname: You should recreate aclocal.m4 with macros from revision $package_revision |
1110 | +$progname: of $PACKAGE $VERSION and run autoconf again. |
1111 | +_LT_EOF |
1112 | + fi |
1113 | + |
1114 | + exit $EXIT_MISMATCH |
1115 | + fi |
1116 | +} |
1117 | + |
1118 | + |
1119 | +# Shorthand for --mode=foo, only valid as the first argument |
1120 | +case $1 in |
1121 | +clean|clea|cle|cl) |
1122 | + shift; set dummy --mode clean ${1+"$@"}; shift |
1123 | + ;; |
1124 | +compile|compil|compi|comp|com|co|c) |
1125 | + shift; set dummy --mode compile ${1+"$@"}; shift |
1126 | + ;; |
1127 | +execute|execut|execu|exec|exe|ex|e) |
1128 | + shift; set dummy --mode execute ${1+"$@"}; shift |
1129 | + ;; |
1130 | +finish|finis|fini|fin|fi|f) |
1131 | + shift; set dummy --mode finish ${1+"$@"}; shift |
1132 | + ;; |
1133 | +install|instal|insta|inst|ins|in|i) |
1134 | + shift; set dummy --mode install ${1+"$@"}; shift |
1135 | + ;; |
1136 | +link|lin|li|l) |
1137 | + shift; set dummy --mode link ${1+"$@"}; shift |
1138 | + ;; |
1139 | +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
1140 | + shift; set dummy --mode uninstall ${1+"$@"}; shift |
1141 | + ;; |
1142 | +esac |
1143 | + |
1144 | + |
1145 | + |
1146 | +# Option defaults: |
1147 | +opt_debug=: |
1148 | +opt_dry_run=false |
1149 | +opt_config=false |
1150 | +opt_preserve_dup_deps=false |
1151 | +opt_features=false |
1152 | +opt_finish=false |
1153 | +opt_help=false |
1154 | +opt_help_all=false |
1155 | +opt_silent=: |
1156 | +opt_verbose=: |
1157 | +opt_silent=false |
1158 | +opt_verbose=false |
1159 | + |
1160 | + |
1161 | +# Parse options once, thoroughly. This comes as soon as possible in the |
1162 | +# script to make things like `--version' happen as quickly as we can. |
1163 | +{ |
1164 | + # this just eases exit handling |
1165 | + while test $# -gt 0; do |
1166 | + opt="$1" |
1167 | + shift |
1168 | + case $opt in |
1169 | + --debug|-x) opt_debug='set -x' |
1170 | + func_echo "enabling shell trace mode" |
1171 | + $opt_debug |
1172 | + ;; |
1173 | + --dry-run|--dryrun|-n) |
1174 | + opt_dry_run=: |
1175 | + ;; |
1176 | + --config) |
1177 | + opt_config=: |
1178 | +func_config |
1179 | + ;; |
1180 | + --dlopen|-dlopen) |
1181 | + optarg="$1" |
1182 | + opt_dlopen="${opt_dlopen+$opt_dlopen |
1183 | +}$optarg" |
1184 | + shift |
1185 | + ;; |
1186 | + --preserve-dup-deps) |
1187 | + opt_preserve_dup_deps=: |
1188 | + ;; |
1189 | + --features) |
1190 | + opt_features=: |
1191 | +func_features |
1192 | + ;; |
1193 | + --finish) |
1194 | + opt_finish=: |
1195 | +set dummy --mode finish ${1+"$@"}; shift |
1196 | + ;; |
1197 | + --help) |
1198 | + opt_help=: |
1199 | + ;; |
1200 | + --help-all) |
1201 | + opt_help_all=: |
1202 | +opt_help=': help-all' |
1203 | + ;; |
1204 | + --mode) |
1205 | + test $# = 0 && func_missing_arg $opt && break |
1206 | + optarg="$1" |
1207 | + opt_mode="$optarg" |
1208 | +case $optarg in |
1209 | + # Valid mode arguments: |
1210 | + clean|compile|execute|finish|install|link|relink|uninstall) ;; |
1211 | + |
1212 | + # Catch anything else as an error |
1213 | + *) func_error "invalid argument for $opt" |
1214 | + exit_cmd=exit |
1215 | + break |
1216 | + ;; |
1217 | +esac |
1218 | + shift |
1219 | + ;; |
1220 | + --no-silent|--no-quiet) |
1221 | + opt_silent=false |
1222 | +func_append preserve_args " $opt" |
1223 | + ;; |
1224 | + --no-verbose) |
1225 | + opt_verbose=false |
1226 | +func_append preserve_args " $opt" |
1227 | + ;; |
1228 | + --silent|--quiet) |
1229 | + opt_silent=: |
1230 | +func_append preserve_args " $opt" |
1231 | + opt_verbose=false |
1232 | + ;; |
1233 | + --verbose|-v) |
1234 | + opt_verbose=: |
1235 | +func_append preserve_args " $opt" |
1236 | +opt_silent=false |
1237 | + ;; |
1238 | + --tag) |
1239 | + test $# = 0 && func_missing_arg $opt && break |
1240 | + optarg="$1" |
1241 | + opt_tag="$optarg" |
1242 | +func_append preserve_args " $opt $optarg" |
1243 | +func_enable_tag "$optarg" |
1244 | + shift |
1245 | + ;; |
1246 | + |
1247 | + -\?|-h) func_usage ;; |
1248 | + --help) func_help ;; |
1249 | + --version) func_version ;; |
1250 | + |
1251 | + # Separate optargs to long options: |
1252 | + --*=*) |
1253 | + func_split_long_opt "$opt" |
1254 | + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} |
1255 | + shift |
1256 | + ;; |
1257 | + |
1258 | + # Separate non-argument short options: |
1259 | + -\?*|-h*|-n*|-v*) |
1260 | + func_split_short_opt "$opt" |
1261 | + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} |
1262 | + shift |
1263 | + ;; |
1264 | + |
1265 | + --) break ;; |
1266 | + -*) func_fatal_help "unrecognized option \`$opt'" ;; |
1267 | + *) set dummy "$opt" ${1+"$@"}; shift; break ;; |
1268 | + esac |
1269 | + done |
1270 | + |
1271 | + # Validate options: |
1272 | + |
1273 | + # save first non-option argument |
1274 | + if test "$#" -gt 0; then |
1275 | + nonopt="$opt" |
1276 | + shift |
1277 | + fi |
1278 | + |
1279 | + # preserve --debug |
1280 | + test "$opt_debug" = : || func_append preserve_args " --debug" |
1281 | + |
1282 | + case $host in |
1283 | + *cygwin* | *mingw* | *pw32* | *cegcc*) |
1284 | + # don't eliminate duplications in $postdeps and $predeps |
1285 | + opt_duplicate_compiler_generated_deps=: |
1286 | + ;; |
1287 | + *) |
1288 | + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps |
1289 | + ;; |
1290 | + esac |
1291 | + |
1292 | + $opt_help || { |
1293 | + # Sanity checks first: |
1294 | + func_check_version_match |
1295 | + |
1296 | + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
1297 | + func_fatal_configuration "not configured to build any kind of library" |
1298 | + fi |
1299 | + |
1300 | + # Darwin sucks |
1301 | + eval std_shrext=\"$shrext_cmds\" |
1302 | + |
1303 | + # Only execute mode is allowed to have -dlopen flags. |
1304 | + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then |
1305 | + func_error "unrecognized option \`-dlopen'" |
1306 | + $ECHO "$help" 1>&2 |
1307 | + exit $EXIT_FAILURE |
1308 | + fi |
1309 | + |
1310 | + # Change the help message to a mode-specific one. |
1311 | + generic_help="$help" |
1312 | + help="Try \`$progname --help --mode=$opt_mode' for more information." |
1313 | + } |
1314 | + |
1315 | + |
1316 | + # Bail if the options were screwed |
1317 | + $exit_cmd $EXIT_FAILURE |
1318 | +} |
1319 | + |
1320 | + |
1321 | + |
1322 | + |
1323 | +## ----------- ## |
1324 | +## Main. ## |
1325 | +## ----------- ## |
1326 | + |
1327 | +# func_lalib_p file |
1328 | +# True iff FILE is a libtool `.la' library or `.lo' object file. |
1329 | +# This function is only a basic sanity check; it will hardly flush out |
1330 | +# determined imposters. |
1331 | +func_lalib_p () |
1332 | +{ |
1333 | + test -f "$1" && |
1334 | + $SED -e 4q "$1" 2>/dev/null \ |
1335 | + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
1336 | +} |
1337 | + |
1338 | +# func_lalib_unsafe_p file |
1339 | +# True iff FILE is a libtool `.la' library or `.lo' object file. |
1340 | +# This function implements the same check as func_lalib_p without |
1341 | +# resorting to external programs. To this end, it redirects stdin and |
1342 | +# closes it afterwards, without saving the original file descriptor. |
1343 | +# As a safety measure, use it only where a negative result would be |
1344 | +# fatal anyway. Works if `file' does not exist. |
1345 | +func_lalib_unsafe_p () |
1346 | +{ |
1347 | + lalib_p=no |
1348 | + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
1349 | + for lalib_p_l in 1 2 3 4 |
1350 | + do |
1351 | + read lalib_p_line |
1352 | + case "$lalib_p_line" in |
1353 | + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
1354 | + esac |
1355 | + done |
1356 | + exec 0<&5 5<&- |
1357 | + fi |
1358 | + test "$lalib_p" = yes |
1359 | +} |
1360 | + |
1361 | +# func_ltwrapper_script_p file |
1362 | +# True iff FILE is a libtool wrapper script |
1363 | +# This function is only a basic sanity check; it will hardly flush out |
1364 | +# determined imposters. |
1365 | +func_ltwrapper_script_p () |
1366 | +{ |
1367 | + func_lalib_p "$1" |
1368 | +} |
1369 | + |
1370 | +# func_ltwrapper_executable_p file |
1371 | +# True iff FILE is a libtool wrapper executable |
1372 | +# This function is only a basic sanity check; it will hardly flush out |
1373 | +# determined imposters. |
1374 | +func_ltwrapper_executable_p () |
1375 | +{ |
1376 | + func_ltwrapper_exec_suffix= |
1377 | + case $1 in |
1378 | + *.exe) ;; |
1379 | + *) func_ltwrapper_exec_suffix=.exe ;; |
1380 | + esac |
1381 | + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
1382 | +} |
1383 | + |
1384 | +# func_ltwrapper_scriptname file |
1385 | +# Assumes file is an ltwrapper_executable |
1386 | +# uses $file to determine the appropriate filename for a |
1387 | +# temporary ltwrapper_script. |
1388 | +func_ltwrapper_scriptname () |
1389 | +{ |
1390 | + func_dirname_and_basename "$1" "" "." |
1391 | + func_stripname '' '.exe' "$func_basename_result" |
1392 | + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
1393 | +} |
1394 | + |
1395 | +# func_ltwrapper_p file |
1396 | +# True iff FILE is a libtool wrapper script or wrapper executable |
1397 | +# This function is only a basic sanity check; it will hardly flush out |
1398 | +# determined imposters. |
1399 | +func_ltwrapper_p () |
1400 | +{ |
1401 | + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
1402 | +} |
1403 | + |
1404 | + |
1405 | +# func_execute_cmds commands fail_cmd |
1406 | +# Execute tilde-delimited COMMANDS. |
1407 | +# If FAIL_CMD is given, eval that upon failure. |
1408 | +# FAIL_CMD may read-access the current command in variable CMD! |
1409 | +func_execute_cmds () |
1410 | +{ |
1411 | + $opt_debug |
1412 | + save_ifs=$IFS; IFS='~' |
1413 | + for cmd in $1; do |
1414 | + IFS=$save_ifs |
1415 | + eval cmd=\"$cmd\" |
1416 | + func_show_eval "$cmd" "${2-:}" |
1417 | + done |
1418 | + IFS=$save_ifs |
1419 | +} |
1420 | + |
1421 | + |
1422 | +# func_source file |
1423 | +# Source FILE, adding directory component if necessary. |
1424 | +# Note that it is not necessary on cygwin/mingw to append a dot to |
1425 | +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
1426 | +# behavior happens only for exec(3), not for open(2)! Also, sourcing |
1427 | +# `FILE.' does not work on cygwin managed mounts. |
1428 | +func_source () |
1429 | +{ |
1430 | + $opt_debug |
1431 | + case $1 in |
1432 | + */* | *\\*) . "$1" ;; |
1433 | + *) . "./$1" ;; |
1434 | + esac |
1435 | +} |
1436 | + |
1437 | + |
1438 | +# func_resolve_sysroot PATH |
1439 | +# Replace a leading = in PATH with a sysroot. Store the result into |
1440 | +# func_resolve_sysroot_result |
1441 | +func_resolve_sysroot () |
1442 | +{ |
1443 | + func_resolve_sysroot_result=$1 |
1444 | + case $func_resolve_sysroot_result in |
1445 | + =*) |
1446 | + func_stripname '=' '' "$func_resolve_sysroot_result" |
1447 | + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result |
1448 | + ;; |
1449 | + esac |
1450 | +} |
1451 | + |
1452 | +# func_replace_sysroot PATH |
1453 | +# If PATH begins with the sysroot, replace it with = and |
1454 | +# store the result into func_replace_sysroot_result. |
1455 | +func_replace_sysroot () |
1456 | +{ |
1457 | + case "$lt_sysroot:$1" in |
1458 | + ?*:"$lt_sysroot"*) |
1459 | + func_stripname "$lt_sysroot" '' "$1" |
1460 | + func_replace_sysroot_result="=$func_stripname_result" |
1461 | + ;; |
1462 | + *) |
1463 | + # Including no sysroot. |
1464 | + func_replace_sysroot_result=$1 |
1465 | + ;; |
1466 | + esac |
1467 | +} |
1468 | + |
1469 | +# func_infer_tag arg |
1470 | +# Infer tagged configuration to use if any are available and |
1471 | +# if one wasn't chosen via the "--tag" command line option. |
1472 | +# Only attempt this if the compiler in the base compile |
1473 | +# command doesn't match the default compiler. |
1474 | +# arg is usually of the form 'gcc ...' |
1475 | +func_infer_tag () |
1476 | +{ |
1477 | + $opt_debug |
1478 | + if test -n "$available_tags" && test -z "$tagname"; then |
1479 | + CC_quoted= |
1480 | + for arg in $CC; do |
1481 | + func_append_quoted CC_quoted "$arg" |
1482 | + done |
1483 | + CC_expanded=`func_echo_all $CC` |
1484 | + CC_quoted_expanded=`func_echo_all $CC_quoted` |
1485 | + case $@ in |
1486 | + # Blanks in the command may have been stripped by the calling shell, |
1487 | + # but not from the CC environment variable when configure was run. |
1488 | + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
1489 | + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
1490 | + # Blanks at the start of $base_compile will cause this to fail |
1491 | + # if we don't check for them as well. |
1492 | + *) |
1493 | + for z in $available_tags; do |
1494 | + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
1495 | + # Evaluate the configuration. |
1496 | + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
1497 | + CC_quoted= |
1498 | + for arg in $CC; do |
1499 | + # Double-quote args containing other shell metacharacters. |
1500 | + func_append_quoted CC_quoted "$arg" |
1501 | + done |
1502 | + CC_expanded=`func_echo_all $CC` |
1503 | + CC_quoted_expanded=`func_echo_all $CC_quoted` |
1504 | + case "$@ " in |
1505 | + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
1506 | + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
1507 | + # The compiler in the base compile command matches |
1508 | + # the one in the tagged configuration. |
1509 | + # Assume this is the tagged configuration we want. |
1510 | + tagname=$z |
1511 | + break |
1512 | + ;; |
1513 | + esac |
1514 | + fi |
1515 | + done |
1516 | + # If $tagname still isn't set, then no tagged configuration |
1517 | + # was found and let the user know that the "--tag" command |
1518 | + # line option must be used. |
1519 | + if test -z "$tagname"; then |
1520 | + func_echo "unable to infer tagged configuration" |
1521 | + func_fatal_error "specify a tag with \`--tag'" |
1522 | +# else |
1523 | +# func_verbose "using $tagname tagged configuration" |
1524 | + fi |
1525 | + ;; |
1526 | + esac |
1527 | + fi |
1528 | +} |
1529 | + |
1530 | + |
1531 | + |
1532 | +# func_write_libtool_object output_name pic_name nonpic_name |
1533 | +# Create a libtool object file (analogous to a ".la" file), |
1534 | +# but don't create it if we're doing a dry run. |
1535 | +func_write_libtool_object () |
1536 | +{ |
1537 | + write_libobj=${1} |
1538 | + if test "$build_libtool_libs" = yes; then |
1539 | + write_lobj=\'${2}\' |
1540 | + else |
1541 | + write_lobj=none |
1542 | + fi |
1543 | + |
1544 | + if test "$build_old_libs" = yes; then |
1545 | + write_oldobj=\'${3}\' |
1546 | + else |
1547 | + write_oldobj=none |
1548 | + fi |
1549 | + |
1550 | + $opt_dry_run || { |
1551 | + cat >${write_libobj}T <<EOF |
1552 | +# $write_libobj - a libtool object file |
1553 | +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
1554 | +# |
1555 | +# Please DO NOT delete this file! |
1556 | +# It is necessary for linking the library. |
1557 | + |
1558 | +# Name of the PIC object. |
1559 | +pic_object=$write_lobj |
1560 | + |
1561 | +# Name of the non-PIC object |
1562 | +non_pic_object=$write_oldobj |
1563 | + |
1564 | +EOF |
1565 | + $MV "${write_libobj}T" "${write_libobj}" |
1566 | + } |
1567 | +} |
1568 | + |
1569 | + |
1570 | +################################################## |
1571 | +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # |
1572 | +################################################## |
1573 | + |
1574 | +# func_convert_core_file_wine_to_w32 ARG |
1575 | +# Helper function used by file name conversion functions when $build is *nix, |
1576 | +# and $host is mingw, cygwin, or some other w32 environment. Relies on a |
1577 | +# correctly configured wine environment available, with the winepath program |
1578 | +# in $build's $PATH. |
1579 | +# |
1580 | +# ARG is the $build file name to be converted to w32 format. |
1581 | +# Result is available in $func_convert_core_file_wine_to_w32_result, and will |
1582 | +# be empty on error (or when ARG is empty) |
1583 | +func_convert_core_file_wine_to_w32 () |
1584 | +{ |
1585 | + $opt_debug |
1586 | + func_convert_core_file_wine_to_w32_result="$1" |
1587 | + if test -n "$1"; then |
1588 | + # Unfortunately, winepath does not exit with a non-zero error code, so we |
1589 | + # are forced to check the contents of stdout. On the other hand, if the |
1590 | + # command is not found, the shell will set an exit code of 127 and print |
1591 | + # *an error message* to stdout. So we must check for both error code of |
1592 | + # zero AND non-empty stdout, which explains the odd construction: |
1593 | + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` |
1594 | + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then |
1595 | + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | |
1596 | + $SED -e "$lt_sed_naive_backslashify"` |
1597 | + else |
1598 | + func_convert_core_file_wine_to_w32_result= |
1599 | + fi |
1600 | + fi |
1601 | +} |
1602 | +# end: func_convert_core_file_wine_to_w32 |
1603 | + |
1604 | + |
1605 | +# func_convert_core_path_wine_to_w32 ARG |
1606 | +# Helper function used by path conversion functions when $build is *nix, and |
1607 | +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly |
1608 | +# configured wine environment available, with the winepath program in $build's |
1609 | +# $PATH. Assumes ARG has no leading or trailing path separator characters. |
1610 | +# |
1611 | +# ARG is path to be converted from $build format to win32. |
1612 | +# Result is available in $func_convert_core_path_wine_to_w32_result. |
1613 | +# Unconvertible file (directory) names in ARG are skipped; if no directory names |
1614 | +# are convertible, then the result may be empty. |
1615 | +func_convert_core_path_wine_to_w32 () |
1616 | +{ |
1617 | + $opt_debug |
1618 | + # unfortunately, winepath doesn't convert paths, only file names |
1619 | + func_convert_core_path_wine_to_w32_result="" |
1620 | + if test -n "$1"; then |
1621 | + oldIFS=$IFS |
1622 | + IFS=: |
1623 | + for func_convert_core_path_wine_to_w32_f in $1; do |
1624 | + IFS=$oldIFS |
1625 | + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" |
1626 | + if test -n "$func_convert_core_file_wine_to_w32_result" ; then |
1627 | + if test -z "$func_convert_core_path_wine_to_w32_result"; then |
1628 | + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" |
1629 | + else |
1630 | + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" |
1631 | + fi |
1632 | + fi |
1633 | + done |
1634 | + IFS=$oldIFS |
1635 | + fi |
1636 | +} |
1637 | +# end: func_convert_core_path_wine_to_w32 |
1638 | + |
1639 | + |
1640 | +# func_cygpath ARGS... |
1641 | +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when |
1642 | +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) |
1643 | +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or |
1644 | +# (2), returns the Cygwin file name or path in func_cygpath_result (input |
1645 | +# file name or path is assumed to be in w32 format, as previously converted |
1646 | +# from $build's *nix or MSYS format). In case (3), returns the w32 file name |
1647 | +# or path in func_cygpath_result (input file name or path is assumed to be in |
1648 | +# Cygwin format). Returns an empty string on error. |
1649 | +# |
1650 | +# ARGS are passed to cygpath, with the last one being the file name or path to |
1651 | +# be converted. |
1652 | +# |
1653 | +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH |
1654 | +# environment variable; do not put it in $PATH. |
1655 | +func_cygpath () |
1656 | +{ |
1657 | + $opt_debug |
1658 | + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then |
1659 | + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` |
1660 | + if test "$?" -ne 0; then |
1661 | + # on failure, ensure result is empty |
1662 | + func_cygpath_result= |
1663 | + fi |
1664 | + else |
1665 | + func_cygpath_result= |
1666 | + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" |
1667 | + fi |
1668 | +} |
1669 | +#end: func_cygpath |
1670 | + |
1671 | + |
1672 | +# func_convert_core_msys_to_w32 ARG |
1673 | +# Convert file name or path ARG from MSYS format to w32 format. Return |
1674 | +# result in func_convert_core_msys_to_w32_result. |
1675 | +func_convert_core_msys_to_w32 () |
1676 | +{ |
1677 | + $opt_debug |
1678 | + # awkward: cmd appends spaces to result |
1679 | + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | |
1680 | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
1681 | +} |
1682 | +#end: func_convert_core_msys_to_w32 |
1683 | + |
1684 | + |
1685 | +# func_convert_file_check ARG1 ARG2 |
1686 | +# Verify that ARG1 (a file name in $build format) was converted to $host |
1687 | +# format in ARG2. Otherwise, emit an error message, but continue (resetting |
1688 | +# func_to_host_file_result to ARG1). |
1689 | +func_convert_file_check () |
1690 | +{ |
1691 | + $opt_debug |
1692 | + if test -z "$2" && test -n "$1" ; then |
1693 | + func_error "Could not determine host file name corresponding to" |
1694 | + func_error " \`$1'" |
1695 | + func_error "Continuing, but uninstalled executables may not work." |
1696 | + # Fallback: |
1697 | + func_to_host_file_result="$1" |
1698 | + fi |
1699 | +} |
1700 | +# end func_convert_file_check |
1701 | + |
1702 | + |
1703 | +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH |
1704 | +# Verify that FROM_PATH (a path in $build format) was converted to $host |
1705 | +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting |
1706 | +# func_to_host_file_result to a simplistic fallback value (see below). |
1707 | +func_convert_path_check () |
1708 | +{ |
1709 | + $opt_debug |
1710 | + if test -z "$4" && test -n "$3"; then |
1711 | + func_error "Could not determine the host path corresponding to" |
1712 | + func_error " \`$3'" |
1713 | + func_error "Continuing, but uninstalled executables may not work." |
1714 | + # Fallback. This is a deliberately simplistic "conversion" and |
1715 | + # should not be "improved". See libtool.info. |
1716 | + if test "x$1" != "x$2"; then |
1717 | + lt_replace_pathsep_chars="s|$1|$2|g" |
1718 | + func_to_host_path_result=`echo "$3" | |
1719 | + $SED -e "$lt_replace_pathsep_chars"` |
1720 | + else |
1721 | + func_to_host_path_result="$3" |
1722 | + fi |
1723 | + fi |
1724 | +} |
1725 | +# end func_convert_path_check |
1726 | + |
1727 | + |
1728 | +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG |
1729 | +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT |
1730 | +# and appending REPL if ORIG matches BACKPAT. |
1731 | +func_convert_path_front_back_pathsep () |
1732 | +{ |
1733 | + $opt_debug |
1734 | + case $4 in |
1735 | + $1 ) func_to_host_path_result="$3$func_to_host_path_result" |
1736 | + ;; |
1737 | + esac |
1738 | + case $4 in |
1739 | + $2 ) func_append func_to_host_path_result "$3" |
1740 | + ;; |
1741 | + esac |
1742 | +} |
1743 | +# end func_convert_path_front_back_pathsep |
1744 | + |
1745 | + |
1746 | +################################################## |
1747 | +# $build to $host FILE NAME CONVERSION FUNCTIONS # |
1748 | +################################################## |
1749 | +# invoked via `$to_host_file_cmd ARG' |
1750 | +# |
1751 | +# In each case, ARG is the path to be converted from $build to $host format. |
1752 | +# Result will be available in $func_to_host_file_result. |
1753 | + |
1754 | + |
1755 | +# func_to_host_file ARG |
1756 | +# Converts the file name ARG from $build format to $host format. Return result |
1757 | +# in func_to_host_file_result. |
1758 | +func_to_host_file () |
1759 | +{ |
1760 | + $opt_debug |
1761 | + $to_host_file_cmd "$1" |
1762 | +} |
1763 | +# end func_to_host_file |
1764 | + |
1765 | + |
1766 | +# func_to_tool_file ARG LAZY |
1767 | +# converts the file name ARG from $build format to toolchain format. Return |
1768 | +# result in func_to_tool_file_result. If the conversion in use is listed |
1769 | +# in (the comma separated) LAZY, no conversion takes place. |
1770 | +func_to_tool_file () |
1771 | +{ |
1772 | + $opt_debug |
1773 | + case ,$2, in |
1774 | + *,"$to_tool_file_cmd",*) |
1775 | + func_to_tool_file_result=$1 |
1776 | + ;; |
1777 | + *) |
1778 | + $to_tool_file_cmd "$1" |
1779 | + func_to_tool_file_result=$func_to_host_file_result |
1780 | + ;; |
1781 | + esac |
1782 | +} |
1783 | +# end func_to_tool_file |
1784 | + |
1785 | + |
1786 | +# func_convert_file_noop ARG |
1787 | +# Copy ARG to func_to_host_file_result. |
1788 | +func_convert_file_noop () |
1789 | +{ |
1790 | + func_to_host_file_result="$1" |
1791 | +} |
1792 | +# end func_convert_file_noop |
1793 | + |
1794 | + |
1795 | +# func_convert_file_msys_to_w32 ARG |
1796 | +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic |
1797 | +# conversion to w32 is not available inside the cwrapper. Returns result in |
1798 | +# func_to_host_file_result. |
1799 | +func_convert_file_msys_to_w32 () |
1800 | +{ |
1801 | + $opt_debug |
1802 | + func_to_host_file_result="$1" |
1803 | + if test -n "$1"; then |
1804 | + func_convert_core_msys_to_w32 "$1" |
1805 | + func_to_host_file_result="$func_convert_core_msys_to_w32_result" |
1806 | + fi |
1807 | + func_convert_file_check "$1" "$func_to_host_file_result" |
1808 | +} |
1809 | +# end func_convert_file_msys_to_w32 |
1810 | + |
1811 | + |
1812 | +# func_convert_file_cygwin_to_w32 ARG |
1813 | +# Convert file name ARG from Cygwin to w32 format. Returns result in |
1814 | +# func_to_host_file_result. |
1815 | +func_convert_file_cygwin_to_w32 () |
1816 | +{ |
1817 | + $opt_debug |
1818 | + func_to_host_file_result="$1" |
1819 | + if test -n "$1"; then |
1820 | + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use |
1821 | + # LT_CYGPATH in this case. |
1822 | + func_to_host_file_result=`cygpath -m "$1"` |
1823 | + fi |
1824 | + func_convert_file_check "$1" "$func_to_host_file_result" |
1825 | +} |
1826 | +# end func_convert_file_cygwin_to_w32 |
1827 | + |
1828 | + |
1829 | +# func_convert_file_nix_to_w32 ARG |
1830 | +# Convert file name ARG from *nix to w32 format. Requires a wine environment |
1831 | +# and a working winepath. Returns result in func_to_host_file_result. |
1832 | +func_convert_file_nix_to_w32 () |
1833 | +{ |
1834 | + $opt_debug |
1835 | + func_to_host_file_result="$1" |
1836 | + if test -n "$1"; then |
1837 | + func_convert_core_file_wine_to_w32 "$1" |
1838 | + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" |
1839 | + fi |
1840 | + func_convert_file_check "$1" "$func_to_host_file_result" |
1841 | +} |
1842 | +# end func_convert_file_nix_to_w32 |
1843 | + |
1844 | + |
1845 | +# func_convert_file_msys_to_cygwin ARG |
1846 | +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
1847 | +# Returns result in func_to_host_file_result. |
1848 | +func_convert_file_msys_to_cygwin () |
1849 | +{ |
1850 | + $opt_debug |
1851 | + func_to_host_file_result="$1" |
1852 | + if test -n "$1"; then |
1853 | + func_convert_core_msys_to_w32 "$1" |
1854 | + func_cygpath -u "$func_convert_core_msys_to_w32_result" |
1855 | + func_to_host_file_result="$func_cygpath_result" |
1856 | + fi |
1857 | + func_convert_file_check "$1" "$func_to_host_file_result" |
1858 | +} |
1859 | +# end func_convert_file_msys_to_cygwin |
1860 | + |
1861 | + |
1862 | +# func_convert_file_nix_to_cygwin ARG |
1863 | +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed |
1864 | +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result |
1865 | +# in func_to_host_file_result. |
1866 | +func_convert_file_nix_to_cygwin () |
1867 | +{ |
1868 | + $opt_debug |
1869 | + func_to_host_file_result="$1" |
1870 | + if test -n "$1"; then |
1871 | + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. |
1872 | + func_convert_core_file_wine_to_w32 "$1" |
1873 | + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" |
1874 | + func_to_host_file_result="$func_cygpath_result" |
1875 | + fi |
1876 | + func_convert_file_check "$1" "$func_to_host_file_result" |
1877 | +} |
1878 | +# end func_convert_file_nix_to_cygwin |
1879 | + |
1880 | + |
1881 | +############################################# |
1882 | +# $build to $host PATH CONVERSION FUNCTIONS # |
1883 | +############################################# |
1884 | +# invoked via `$to_host_path_cmd ARG' |
1885 | +# |
1886 | +# In each case, ARG is the path to be converted from $build to $host format. |
1887 | +# The result will be available in $func_to_host_path_result. |
1888 | +# |
1889 | +# Path separators are also converted from $build format to $host format. If |
1890 | +# ARG begins or ends with a path separator character, it is preserved (but |
1891 | +# converted to $host format) on output. |
1892 | +# |
1893 | +# All path conversion functions are named using the following convention: |
1894 | +# file name conversion function : func_convert_file_X_to_Y () |
1895 | +# path conversion function : func_convert_path_X_to_Y () |
1896 | +# where, for any given $build/$host combination the 'X_to_Y' value is the |
1897 | +# same. If conversion functions are added for new $build/$host combinations, |
1898 | +# the two new functions must follow this pattern, or func_init_to_host_path_cmd |
1899 | +# will break. |
1900 | + |
1901 | + |
1902 | +# func_init_to_host_path_cmd |
1903 | +# Ensures that function "pointer" variable $to_host_path_cmd is set to the |
1904 | +# appropriate value, based on the value of $to_host_file_cmd. |
1905 | +to_host_path_cmd= |
1906 | +func_init_to_host_path_cmd () |
1907 | +{ |
1908 | + $opt_debug |
1909 | + if test -z "$to_host_path_cmd"; then |
1910 | + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" |
1911 | + to_host_path_cmd="func_convert_path_${func_stripname_result}" |
1912 | + fi |
1913 | +} |
1914 | + |
1915 | + |
1916 | +# func_to_host_path ARG |
1917 | +# Converts the path ARG from $build format to $host format. Return result |
1918 | +# in func_to_host_path_result. |
1919 | +func_to_host_path () |
1920 | +{ |
1921 | + $opt_debug |
1922 | + func_init_to_host_path_cmd |
1923 | + $to_host_path_cmd "$1" |
1924 | +} |
1925 | +# end func_to_host_path |
1926 | + |
1927 | + |
1928 | +# func_convert_path_noop ARG |
1929 | +# Copy ARG to func_to_host_path_result. |
1930 | +func_convert_path_noop () |
1931 | +{ |
1932 | + func_to_host_path_result="$1" |
1933 | +} |
1934 | +# end func_convert_path_noop |
1935 | + |
1936 | + |
1937 | +# func_convert_path_msys_to_w32 ARG |
1938 | +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic |
1939 | +# conversion to w32 is not available inside the cwrapper. Returns result in |
1940 | +# func_to_host_path_result. |
1941 | +func_convert_path_msys_to_w32 () |
1942 | +{ |
1943 | + $opt_debug |
1944 | + func_to_host_path_result="$1" |
1945 | + if test -n "$1"; then |
1946 | + # Remove leading and trailing path separator characters from ARG. MSYS |
1947 | + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; |
1948 | + # and winepath ignores them completely. |
1949 | + func_stripname : : "$1" |
1950 | + func_to_host_path_tmp1=$func_stripname_result |
1951 | + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
1952 | + func_to_host_path_result="$func_convert_core_msys_to_w32_result" |
1953 | + func_convert_path_check : ";" \ |
1954 | + "$func_to_host_path_tmp1" "$func_to_host_path_result" |
1955 | + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
1956 | + fi |
1957 | +} |
1958 | +# end func_convert_path_msys_to_w32 |
1959 | + |
1960 | + |
1961 | +# func_convert_path_cygwin_to_w32 ARG |
1962 | +# Convert path ARG from Cygwin to w32 format. Returns result in |
1963 | +# func_to_host_file_result. |
1964 | +func_convert_path_cygwin_to_w32 () |
1965 | +{ |
1966 | + $opt_debug |
1967 | + func_to_host_path_result="$1" |
1968 | + if test -n "$1"; then |
1969 | + # See func_convert_path_msys_to_w32: |
1970 | + func_stripname : : "$1" |
1971 | + func_to_host_path_tmp1=$func_stripname_result |
1972 | + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` |
1973 | + func_convert_path_check : ";" \ |
1974 | + "$func_to_host_path_tmp1" "$func_to_host_path_result" |
1975 | + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
1976 | + fi |
1977 | +} |
1978 | +# end func_convert_path_cygwin_to_w32 |
1979 | + |
1980 | + |
1981 | +# func_convert_path_nix_to_w32 ARG |
1982 | +# Convert path ARG from *nix to w32 format. Requires a wine environment and |
1983 | +# a working winepath. Returns result in func_to_host_file_result. |
1984 | +func_convert_path_nix_to_w32 () |
1985 | +{ |
1986 | + $opt_debug |
1987 | + func_to_host_path_result="$1" |
1988 | + if test -n "$1"; then |
1989 | + # See func_convert_path_msys_to_w32: |
1990 | + func_stripname : : "$1" |
1991 | + func_to_host_path_tmp1=$func_stripname_result |
1992 | + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
1993 | + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" |
1994 | + func_convert_path_check : ";" \ |
1995 | + "$func_to_host_path_tmp1" "$func_to_host_path_result" |
1996 | + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" |
1997 | + fi |
1998 | +} |
1999 | +# end func_convert_path_nix_to_w32 |
2000 | + |
2001 | + |
2002 | +# func_convert_path_msys_to_cygwin ARG |
2003 | +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
2004 | +# Returns result in func_to_host_file_result. |
2005 | +func_convert_path_msys_to_cygwin () |
2006 | +{ |
2007 | + $opt_debug |
2008 | + func_to_host_path_result="$1" |
2009 | + if test -n "$1"; then |
2010 | + # See func_convert_path_msys_to_w32: |
2011 | + func_stripname : : "$1" |
2012 | + func_to_host_path_tmp1=$func_stripname_result |
2013 | + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
2014 | + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" |
2015 | + func_to_host_path_result="$func_cygpath_result" |
2016 | + func_convert_path_check : : \ |
2017 | + "$func_to_host_path_tmp1" "$func_to_host_path_result" |
2018 | + func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
2019 | + fi |
2020 | +} |
2021 | +# end func_convert_path_msys_to_cygwin |
2022 | + |
2023 | + |
2024 | +# func_convert_path_nix_to_cygwin ARG |
2025 | +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a |
2026 | +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in |
2027 | +# func_to_host_file_result. |
2028 | +func_convert_path_nix_to_cygwin () |
2029 | +{ |
2030 | + $opt_debug |
2031 | + func_to_host_path_result="$1" |
2032 | + if test -n "$1"; then |
2033 | + # Remove leading and trailing path separator characters from |
2034 | + # ARG. msys behavior is inconsistent here, cygpath turns them |
2035 | + # into '.;' and ';.', and winepath ignores them completely. |
2036 | + func_stripname : : "$1" |
2037 | + func_to_host_path_tmp1=$func_stripname_result |
2038 | + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
2039 | + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" |
2040 | + func_to_host_path_result="$func_cygpath_result" |
2041 | + func_convert_path_check : : \ |
2042 | + "$func_to_host_path_tmp1" "$func_to_host_path_result" |
2043 | + func_convert_path_front_back_pathsep ":*" "*:" : "$1" |
2044 | + fi |
2045 | +} |
2046 | +# end func_convert_path_nix_to_cygwin |
2047 | + |
2048 | + |
2049 | +# func_mode_compile arg... |
2050 | +func_mode_compile () |
2051 | +{ |
2052 | + $opt_debug |
2053 | + # Get the compilation command and the source file. |
2054 | + base_compile= |
2055 | + srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
2056 | + suppress_opt=yes |
2057 | + suppress_output= |
2058 | + arg_mode=normal |
2059 | + libobj= |
2060 | + later= |
2061 | + pie_flag= |
2062 | + |
2063 | + for arg |
2064 | + do |
2065 | + case $arg_mode in |
2066 | + arg ) |
2067 | + # do not "continue". Instead, add this to base_compile |
2068 | + lastarg="$arg" |
2069 | + arg_mode=normal |
2070 | + ;; |
2071 | + |
2072 | + target ) |
2073 | + libobj="$arg" |
2074 | + arg_mode=normal |
2075 | + continue |
2076 | + ;; |
2077 | + |
2078 | + normal ) |
2079 | + # Accept any command-line options. |
2080 | + case $arg in |
2081 | + -o) |
2082 | + test -n "$libobj" && \ |
2083 | + func_fatal_error "you cannot specify \`-o' more than once" |
2084 | + arg_mode=target |
2085 | + continue |
2086 | + ;; |
2087 | + |
2088 | + -pie | -fpie | -fPIE) |
2089 | + func_append pie_flag " $arg" |
2090 | + continue |
2091 | + ;; |
2092 | + |
2093 | + -shared | -static | -prefer-pic | -prefer-non-pic) |
2094 | + func_append later " $arg" |
2095 | + continue |
2096 | + ;; |
2097 | + |
2098 | + -no-suppress) |
2099 | + suppress_opt=no |
2100 | + continue |
2101 | + ;; |
2102 | + |
2103 | + -Xcompiler) |
2104 | + arg_mode=arg # the next one goes into the "base_compile" arg list |
2105 | + continue # The current "srcfile" will either be retained or |
2106 | + ;; # replaced later. I would guess that would be a bug. |
2107 | + |
2108 | + -Wc,*) |
2109 | + func_stripname '-Wc,' '' "$arg" |
2110 | + args=$func_stripname_result |
2111 | + lastarg= |
2112 | + save_ifs="$IFS"; IFS=',' |
2113 | + for arg in $args; do |
2114 | + IFS="$save_ifs" |
2115 | + func_append_quoted lastarg "$arg" |
2116 | + done |
2117 | + IFS="$save_ifs" |
2118 | + func_stripname ' ' '' "$lastarg" |
2119 | + lastarg=$func_stripname_result |
2120 | + |
2121 | + # Add the arguments to base_compile. |
2122 | + func_append base_compile " $lastarg" |
2123 | + continue |
2124 | + ;; |
2125 | + |
2126 | + *) |
2127 | + # Accept the current argument as the source file. |
2128 | + # The previous "srcfile" becomes the current argument. |
2129 | + # |
2130 | + lastarg="$srcfile" |
2131 | + srcfile="$arg" |
2132 | + ;; |
2133 | + esac # case $arg |
2134 | + ;; |
2135 | + esac # case $arg_mode |
2136 | + |
2137 | + # Aesthetically quote the previous argument. |
2138 | + func_append_quoted base_compile "$lastarg" |
2139 | + done # for arg |
2140 | + |
2141 | + case $arg_mode in |
2142 | + arg) |
2143 | + func_fatal_error "you must specify an argument for -Xcompile" |
2144 | + ;; |
2145 | + target) |
2146 | + func_fatal_error "you must specify a target with \`-o'" |
2147 | + ;; |
2148 | + *) |
2149 | + # Get the name of the library object. |
2150 | + test -z "$libobj" && { |
2151 | + func_basename "$srcfile" |
2152 | + libobj="$func_basename_result" |
2153 | + } |
2154 | + ;; |
2155 | + esac |
2156 | + |
2157 | + # Recognize several different file suffixes. |
2158 | + # If the user specifies -o file.o, it is replaced with file.lo |
2159 | + case $libobj in |
2160 | + *.[cCFSifmso] | \ |
2161 | + *.ada | *.adb | *.ads | *.asm | \ |
2162 | + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
2163 | + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) |
2164 | + func_xform "$libobj" |
2165 | + libobj=$func_xform_result |
2166 | + ;; |
2167 | + esac |
2168 | + |
2169 | + case $libobj in |
2170 | + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
2171 | + *) |
2172 | + func_fatal_error "cannot determine name of library object from \`$libobj'" |
2173 | + ;; |
2174 | + esac |
2175 | + |
2176 | + func_infer_tag $base_compile |
2177 | + |
2178 | + for arg in $later; do |
2179 | + case $arg in |
2180 | + -shared) |
2181 | + test "$build_libtool_libs" != yes && \ |
2182 | + func_fatal_configuration "can not build a shared library" |
2183 | + build_old_libs=no |
2184 | + continue |
2185 | + ;; |
2186 | + |
2187 | + -static) |
2188 | + build_libtool_libs=no |
2189 | + build_old_libs=yes |
2190 | + continue |
2191 | + ;; |
2192 | + |
2193 | + -prefer-pic) |
2194 | + pic_mode=yes |
2195 | + continue |
2196 | + ;; |
2197 | + |
2198 | + -prefer-non-pic) |
2199 | + pic_mode=no |
2200 | + continue |
2201 | + ;; |
2202 | + esac |
2203 | + done |
2204 | + |
2205 | + func_quote_for_eval "$libobj" |
2206 | + test "X$libobj" != "X$func_quote_for_eval_result" \ |
2207 | + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
2208 | + && func_warning "libobj name \`$libobj' may not contain shell special characters." |
2209 | + func_dirname_and_basename "$obj" "/" "" |
2210 | + objname="$func_basename_result" |
2211 | + xdir="$func_dirname_result" |
2212 | + lobj=${xdir}$objdir/$objname |
2213 | + |
2214 | + test -z "$base_compile" && \ |
2215 | + func_fatal_help "you must specify a compilation command" |
2216 | + |
2217 | + # Delete any leftover library objects. |
2218 | + if test "$build_old_libs" = yes; then |
2219 | + removelist="$obj $lobj $libobj ${libobj}T" |
2220 | + else |
2221 | + removelist="$lobj $libobj ${libobj}T" |
2222 | + fi |
2223 | + |
2224 | + # On Cygwin there's no "real" PIC flag so we must build both object types |
2225 | + case $host_os in |
2226 | + cygwin* | mingw* | pw32* | os2* | cegcc*) |
2227 | + pic_mode=default |
2228 | + ;; |
2229 | + esac |
2230 | + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
2231 | + # non-PIC code in shared libraries is not supported |
2232 | + pic_mode=default |
2233 | + fi |
2234 | + |
2235 | + # Calculate the filename of the output object if compiler does |
2236 | + # not support -o with -c |
2237 | + if test "$compiler_c_o" = no; then |
2238 | + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
2239 | + lockfile="$output_obj.lock" |
2240 | + else |
2241 | + output_obj= |
2242 | + need_locks=no |
2243 | + lockfile= |
2244 | + fi |
2245 | + |
2246 | + # Lock this critical section if it is needed |
2247 | + # We use this script file to make the link, it avoids creating a new file |
2248 | + if test "$need_locks" = yes; then |
2249 | + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
2250 | + func_echo "Waiting for $lockfile to be removed" |
2251 | + sleep 2 |
2252 | + done |
2253 | + elif test "$need_locks" = warn; then |
2254 | + if test -f "$lockfile"; then |
2255 | + $ECHO "\ |
2256 | +*** ERROR, $lockfile exists and contains: |
2257 | +`cat $lockfile 2>/dev/null` |
2258 | + |
2259 | +This indicates that another process is trying to use the same |
2260 | +temporary object file, and libtool could not work around it because |
2261 | +your compiler does not support \`-c' and \`-o' together. If you |
2262 | +repeat this compilation, it may succeed, by chance, but you had better |
2263 | +avoid parallel builds (make -j) in this platform, or get a better |
2264 | +compiler." |
2265 | + |
2266 | + $opt_dry_run || $RM $removelist |
2267 | + exit $EXIT_FAILURE |
2268 | + fi |
2269 | + func_append removelist " $output_obj" |
2270 | + $ECHO "$srcfile" > "$lockfile" |
2271 | + fi |
2272 | + |
2273 | + $opt_dry_run || $RM $removelist |
2274 | + func_append removelist " $lockfile" |
2275 | + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
2276 | + |
2277 | + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 |
2278 | + srcfile=$func_to_tool_file_result |
2279 | + func_quote_for_eval "$srcfile" |
2280 | + qsrcfile=$func_quote_for_eval_result |
2281 | + |
2282 | + # Only build a PIC object if we are building libtool libraries. |
2283 | + if test "$build_libtool_libs" = yes; then |
2284 | + # Without this assignment, base_compile gets emptied. |
2285 | + fbsd_hideous_sh_bug=$base_compile |
2286 | + |
2287 | + if test "$pic_mode" != no; then |
2288 | + command="$base_compile $qsrcfile $pic_flag" |
2289 | + else |
2290 | + # Don't build PIC code |
2291 | + command="$base_compile $qsrcfile" |
2292 | + fi |
2293 | + |
2294 | + func_mkdir_p "$xdir$objdir" |
2295 | + |
2296 | + if test -z "$output_obj"; then |
2297 | + # Place PIC objects in $objdir |
2298 | + func_append command " -o $lobj" |
2299 | + fi |
2300 | + |
2301 | + func_show_eval_locale "$command" \ |
2302 | + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
2303 | + |
2304 | + if test "$need_locks" = warn && |
2305 | + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
2306 | + $ECHO "\ |
2307 | +*** ERROR, $lockfile contains: |
2308 | +`cat $lockfile 2>/dev/null` |
2309 | + |
2310 | +but it should contain: |
2311 | +$srcfile |
2312 | + |
2313 | +This indicates that another process is trying to use the same |
2314 | +temporary object file, and libtool could not work around it because |
2315 | +your compiler does not support \`-c' and \`-o' together. If you |
2316 | +repeat this compilation, it may succeed, by chance, but you had better |
2317 | +avoid parallel builds (make -j) in this platform, or get a better |
2318 | +compiler." |
2319 | + |
2320 | + $opt_dry_run || $RM $removelist |
2321 | + exit $EXIT_FAILURE |
2322 | + fi |
2323 | + |
2324 | + # Just move the object if needed, then go on to compile the next one |
2325 | + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
2326 | + func_show_eval '$MV "$output_obj" "$lobj"' \ |
2327 | + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
2328 | + fi |
2329 | + |
2330 | + # Allow error messages only from the first compilation. |
2331 | + if test "$suppress_opt" = yes; then |
2332 | + suppress_output=' >/dev/null 2>&1' |
2333 | + fi |
2334 | + fi |
2335 | + |
2336 | + # Only build a position-dependent object if we build old libraries. |
2337 | + if test "$build_old_libs" = yes; then |
2338 | + if test "$pic_mode" != yes; then |
2339 | + # Don't build PIC code |
2340 | + command="$base_compile $qsrcfile$pie_flag" |
2341 | + else |
2342 | + command="$base_compile $qsrcfile $pic_flag" |
2343 | + fi |
2344 | + if test "$compiler_c_o" = yes; then |
2345 | + func_append command " -o $obj" |
2346 | + fi |
2347 | + |
2348 | + # Suppress compiler output if we already did a PIC compilation. |
2349 | + func_append command "$suppress_output" |
2350 | + func_show_eval_locale "$command" \ |
2351 | + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
2352 | + |
2353 | + if test "$need_locks" = warn && |
2354 | + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
2355 | + $ECHO "\ |
2356 | +*** ERROR, $lockfile contains: |
2357 | +`cat $lockfile 2>/dev/null` |
2358 | + |
2359 | +but it should contain: |
2360 | +$srcfile |
2361 | + |
2362 | +This indicates that another process is trying to use the same |
2363 | +temporary object file, and libtool could not work around it because |
2364 | +your compiler does not support \`-c' and \`-o' together. If you |
2365 | +repeat this compilation, it may succeed, by chance, but you had better |
2366 | +avoid parallel builds (make -j) in this platform, or get a better |
2367 | +compiler." |
2368 | + |
2369 | + $opt_dry_run || $RM $removelist |
2370 | + exit $EXIT_FAILURE |
2371 | + fi |
2372 | + |
2373 | + # Just move the object if needed |
2374 | + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
2375 | + func_show_eval '$MV "$output_obj" "$obj"' \ |
2376 | + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
2377 | + fi |
2378 | + fi |
2379 | + |
2380 | + $opt_dry_run || { |
2381 | + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
2382 | + |
2383 | + # Unlock the critical section if it was locked |
2384 | + if test "$need_locks" != no; then |
2385 | + removelist=$lockfile |
2386 | + $RM "$lockfile" |
2387 | + fi |
2388 | + } |
2389 | + |
2390 | + exit $EXIT_SUCCESS |
2391 | +} |
2392 | + |
2393 | +$opt_help || { |
2394 | + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} |
2395 | +} |
2396 | + |
2397 | +func_mode_help () |
2398 | +{ |
2399 | + # We need to display help for each of the modes. |
2400 | + case $opt_mode in |
2401 | + "") |
2402 | + # Generic help is extracted from the usage comments |
2403 | + # at the start of this file. |
2404 | + func_help |
2405 | + ;; |
2406 | + |
2407 | + clean) |
2408 | + $ECHO \ |
2409 | +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
2410 | + |
2411 | +Remove files from the build directory. |
2412 | + |
2413 | +RM is the name of the program to use to delete files associated with each FILE |
2414 | +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
2415 | +to RM. |
2416 | + |
2417 | +If FILE is a libtool library, object or program, all the files associated |
2418 | +with it are deleted. Otherwise, only FILE itself is deleted using RM." |
2419 | + ;; |
2420 | + |
2421 | + compile) |
2422 | + $ECHO \ |
2423 | +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
2424 | + |
2425 | +Compile a source file into a libtool library object. |
2426 | + |
2427 | +This mode accepts the following additional options: |
2428 | + |
2429 | + -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
2430 | + -no-suppress do not suppress compiler output for multiple passes |
2431 | + -prefer-pic try to build PIC objects only |
2432 | + -prefer-non-pic try to build non-PIC objects only |
2433 | + -shared do not build a \`.o' file suitable for static linking |
2434 | + -static only build a \`.o' file suitable for static linking |
2435 | + -Wc,FLAG pass FLAG directly to the compiler |
2436 | + |
2437 | +COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
2438 | +from the given SOURCEFILE. |
2439 | + |
2440 | +The output file name is determined by removing the directory component from |
2441 | +SOURCEFILE, then substituting the C source code suffix \`.c' with the |
2442 | +library object suffix, \`.lo'." |
2443 | + ;; |
2444 | + |
2445 | + execute) |
2446 | + $ECHO \ |
2447 | +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
2448 | + |
2449 | +Automatically set library path, then run a program. |
2450 | + |
2451 | +This mode accepts the following additional options: |
2452 | + |
2453 | + -dlopen FILE add the directory containing FILE to the library path |
2454 | + |
2455 | +This mode sets the library path environment variable according to \`-dlopen' |
2456 | +flags. |
2457 | + |
2458 | +If any of the ARGS are libtool executable wrappers, then they are translated |
2459 | +into their corresponding uninstalled binary, and any of their required library |
2460 | +directories are added to the library path. |
2461 | + |
2462 | +Then, COMMAND is executed, with ARGS as arguments." |
2463 | + ;; |
2464 | + |
2465 | + finish) |
2466 | + $ECHO \ |
2467 | +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
2468 | + |
2469 | +Complete the installation of libtool libraries. |
2470 | + |
2471 | +Each LIBDIR is a directory that contains libtool libraries. |
2472 | + |
2473 | +The commands that this mode executes may require superuser privileges. Use |
2474 | +the \`--dry-run' option if you just want to see what would be executed." |
2475 | + ;; |
2476 | + |
2477 | + install) |
2478 | + $ECHO \ |
2479 | +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
2480 | + |
2481 | +Install executables or libraries. |
2482 | + |
2483 | +INSTALL-COMMAND is the installation command. The first component should be |
2484 | +either the \`install' or \`cp' program. |
2485 | + |
2486 | +The following components of INSTALL-COMMAND are treated specially: |
2487 | + |
2488 | + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
2489 | + |
2490 | +The rest of the components are interpreted as arguments to that command (only |
2491 | +BSD-compatible install options are recognized)." |
2492 | + ;; |
2493 | + |
2494 | + link) |
2495 | + $ECHO \ |
2496 | +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
2497 | + |
2498 | +Link object files or libraries together to form another library, or to |
2499 | +create an executable program. |
2500 | + |
2501 | +LINK-COMMAND is a command using the C compiler that you would use to create |
2502 | +a program from several object files. |
2503 | + |
2504 | +The following components of LINK-COMMAND are treated specially: |
2505 | + |
2506 | + -all-static do not do any dynamic linking at all |
2507 | + -avoid-version do not add a version suffix if possible |
2508 | + -bindir BINDIR specify path to binaries directory (for systems where |
2509 | + libraries must be found in the PATH setting at runtime) |
2510 | + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
2511 | + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
2512 | + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
2513 | + -export-symbols SYMFILE |
2514 | + try to export only the symbols listed in SYMFILE |
2515 | + -export-symbols-regex REGEX |
2516 | + try to export only the symbols matching REGEX |
2517 | + -LLIBDIR search LIBDIR for required installed libraries |
2518 | + -lNAME OUTPUT-FILE requires the installed library libNAME |
2519 | + -module build a library that can dlopened |
2520 | + -no-fast-install disable the fast-install mode |
2521 | + -no-install link a not-installable executable |
2522 | + -no-undefined declare that a library does not refer to external symbols |
2523 | + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
2524 | + -objectlist FILE Use a list of object files found in FILE to specify objects |
2525 | + -precious-files-regex REGEX |
2526 | + don't remove output files matching REGEX |
2527 | + -release RELEASE specify package release information |
2528 | + -rpath LIBDIR the created library will eventually be installed in LIBDIR |
2529 | + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
2530 | + -shared only do dynamic linking of libtool libraries |
2531 | + -shrext SUFFIX override the standard shared library file extension |
2532 | + -static do not do any dynamic linking of uninstalled libtool libraries |
2533 | + -static-libtool-libs |
2534 | + do not do any dynamic linking of libtool libraries |
2535 | + -version-info CURRENT[:REVISION[:AGE]] |
2536 | + specify library version info [each variable defaults to 0] |
2537 | + -weak LIBNAME declare that the target provides the LIBNAME interface |
2538 | + -Wc,FLAG |
2539 | + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
2540 | + -Wl,FLAG |
2541 | + -Xlinker FLAG pass linker-specific FLAG directly to the linker |
2542 | + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
2543 | + |
2544 | +All other options (arguments beginning with \`-') are ignored. |
2545 | + |
2546 | +Every other argument is treated as a filename. Files ending in \`.la' are |
2547 | +treated as uninstalled libtool libraries, other files are standard or library |
2548 | +object files. |
2549 | + |
2550 | +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
2551 | +only library objects (\`.lo' files) may be specified, and \`-rpath' is |
2552 | +required, except when creating a convenience library. |
2553 | + |
2554 | +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
2555 | +using \`ar' and \`ranlib', or on Windows using \`lib'. |
2556 | + |
2557 | +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
2558 | +is created, otherwise an executable program is created." |
2559 | + ;; |
2560 | + |
2561 | + uninstall) |
2562 | + $ECHO \ |
2563 | +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
2564 | + |
2565 | +Remove libraries from an installation directory. |
2566 | + |
2567 | +RM is the name of the program to use to delete files associated with each FILE |
2568 | +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
2569 | +to RM. |
2570 | + |
2571 | +If FILE is a libtool library, all the files associated with it are deleted. |
2572 | +Otherwise, only FILE itself is deleted using RM." |
2573 | + ;; |
2574 | + |
2575 | + *) |
2576 | + func_fatal_help "invalid operation mode \`$opt_mode'" |
2577 | + ;; |
2578 | + esac |
2579 | + |
2580 | + echo |
2581 | + $ECHO "Try \`$progname --help' for more information about other modes." |
2582 | +} |
2583 | + |
2584 | +# Now that we've collected a possible --mode arg, show help if necessary |
2585 | +if $opt_help; then |
2586 | + if test "$opt_help" = :; then |
2587 | + func_mode_help |
2588 | + else |
2589 | + { |
2590 | + func_help noexit |
2591 | + for opt_mode in compile link execute install finish uninstall clean; do |
2592 | + func_mode_help |
2593 | + done |
2594 | + } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
2595 | + { |
2596 | + func_help noexit |
2597 | + for opt_mode in compile link execute install finish uninstall clean; do |
2598 | + echo |
2599 | + func_mode_help |
2600 | + done |
2601 | + } | |
2602 | + sed '1d |
2603 | + /^When reporting/,/^Report/{ |
2604 | + H |
2605 | + d |
2606 | + } |
2607 | + $x |
2608 | + /information about other modes/d |
2609 | + /more detailed .*MODE/d |
2610 | + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
2611 | + fi |
2612 | + exit $? |
2613 | +fi |
2614 | + |
2615 | + |
2616 | +# func_mode_execute arg... |
2617 | +func_mode_execute () |
2618 | +{ |
2619 | + $opt_debug |
2620 | + # The first argument is the command name. |
2621 | + cmd="$nonopt" |
2622 | + test -z "$cmd" && \ |
2623 | + func_fatal_help "you must specify a COMMAND" |
2624 | + |
2625 | + # Handle -dlopen flags immediately. |
2626 | + for file in $opt_dlopen; do |
2627 | + test -f "$file" \ |
2628 | + || func_fatal_help "\`$file' is not a file" |
2629 | + |
2630 | + dir= |
2631 | + case $file in |
2632 | + *.la) |
2633 | + func_resolve_sysroot "$file" |
2634 | + file=$func_resolve_sysroot_result |
2635 | + |
2636 | + # Check to see that this really is a libtool archive. |
2637 | + func_lalib_unsafe_p "$file" \ |
2638 | + || func_fatal_help "\`$lib' is not a valid libtool archive" |
2639 | + |
2640 | + # Read the libtool library. |
2641 | + dlname= |
2642 | + library_names= |
2643 | + func_source "$file" |
2644 | + |
2645 | + # Skip this library if it cannot be dlopened. |
2646 | + if test -z "$dlname"; then |
2647 | + # Warn if it was a shared library. |
2648 | + test -n "$library_names" && \ |
2649 | + func_warning "\`$file' was not linked with \`-export-dynamic'" |
2650 | + continue |
2651 | + fi |
2652 | + |
2653 | + func_dirname "$file" "" "." |
2654 | + dir="$func_dirname_result" |
2655 | + |
2656 | + if test -f "$dir/$objdir/$dlname"; then |
2657 | + func_append dir "/$objdir" |
2658 | + else |
2659 | + if test ! -f "$dir/$dlname"; then |
2660 | + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
2661 | + fi |
2662 | + fi |
2663 | + ;; |
2664 | + |
2665 | + *.lo) |
2666 | + # Just add the directory containing the .lo file. |
2667 | + func_dirname "$file" "" "." |
2668 | + dir="$func_dirname_result" |
2669 | + ;; |
2670 | + |
2671 | + *) |
2672 | + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
2673 | + continue |
2674 | + ;; |
2675 | + esac |
2676 | + |
2677 | + # Get the absolute pathname. |
2678 | + absdir=`cd "$dir" && pwd` |
2679 | + test -n "$absdir" && dir="$absdir" |
2680 | + |
2681 | + # Now add the directory to shlibpath_var. |
2682 | + if eval "test -z \"\$$shlibpath_var\""; then |
2683 | + eval "$shlibpath_var=\"\$dir\"" |
2684 | + else |
2685 | + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
2686 | + fi |
2687 | + done |
2688 | + |
2689 | + # This variable tells wrapper scripts just to set shlibpath_var |
2690 | + # rather than running their programs. |
2691 | + libtool_execute_magic="$magic" |
2692 | + |
2693 | + # Check if any of the arguments is a wrapper script. |
2694 | + args= |
2695 | + for file |
2696 | + do |
2697 | + case $file in |
2698 | + -* | *.la | *.lo ) ;; |
2699 | + *) |
2700 | + # Do a test to see if this is really a libtool program. |
2701 | + if func_ltwrapper_script_p "$file"; then |
2702 | + func_source "$file" |
2703 | + # Transform arg to wrapped name. |
2704 | + file="$progdir/$program" |
2705 | + elif func_ltwrapper_executable_p "$file"; then |
2706 | + func_ltwrapper_scriptname "$file" |
2707 | + func_source "$func_ltwrapper_scriptname_result" |
2708 | + # Transform arg to wrapped name. |
2709 | + file="$progdir/$program" |
2710 | + fi |
2711 | + ;; |
2712 | + esac |
2713 | + # Quote arguments (to preserve shell metacharacters). |
2714 | + func_append_quoted args "$file" |
2715 | + done |
2716 | + |
2717 | + if test "X$opt_dry_run" = Xfalse; then |
2718 | + if test -n "$shlibpath_var"; then |
2719 | + # Export the shlibpath_var. |
2720 | + eval "export $shlibpath_var" |
2721 | + fi |
2722 | + |
2723 | + # Restore saved environment variables |
2724 | + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
2725 | + do |
2726 | + eval "if test \"\${save_$lt_var+set}\" = set; then |
2727 | + $lt_var=\$save_$lt_var; export $lt_var |
2728 | + else |
2729 | + $lt_unset $lt_var |
2730 | + fi" |
2731 | + done |
2732 | + |
2733 | + # Now prepare to actually exec the command. |
2734 | + exec_cmd="\$cmd$args" |
2735 | + else |
2736 | + # Display what would be done. |
2737 | + if test -n "$shlibpath_var"; then |
2738 | + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
2739 | + echo "export $shlibpath_var" |
2740 | + fi |
2741 | + $ECHO "$cmd$args" |
2742 | + exit $EXIT_SUCCESS |
2743 | + fi |
2744 | +} |
2745 | + |
2746 | +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} |
2747 | + |
2748 | + |
2749 | +# func_mode_finish arg... |
2750 | +func_mode_finish () |
2751 | +{ |
2752 | + $opt_debug |
2753 | + libs= |
2754 | + libdirs= |
2755 | + admincmds= |
2756 | + |
2757 | + for opt in "$nonopt" ${1+"$@"} |
2758 | + do |
2759 | + if test -d "$opt"; then |
2760 | + func_append libdirs " $opt" |
2761 | + |
2762 | + elif test -f "$opt"; then |
2763 | + if func_lalib_unsafe_p "$opt"; then |
2764 | + func_append libs " $opt" |
2765 | + else |
2766 | + func_warning "\`$opt' is not a valid libtool archive" |
2767 | + fi |
2768 | + |
2769 | + else |
2770 | + func_fatal_error "invalid argument \`$opt'" |
2771 | + fi |
2772 | + done |
2773 | + |
2774 | + if test -n "$libs"; then |
2775 | + if test -n "$lt_sysroot"; then |
2776 | + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` |
2777 | + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" |
2778 | + else |
2779 | + sysroot_cmd= |
2780 | + fi |
2781 | + |
2782 | + # Remove sysroot references |
2783 | + if $opt_dry_run; then |
2784 | + for lib in $libs; do |
2785 | + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" |
2786 | + done |
2787 | + else |
2788 | + tmpdir=`func_mktempdir` |
2789 | + for lib in $libs; do |
2790 | + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ |
2791 | + > $tmpdir/tmp-la |
2792 | + mv -f $tmpdir/tmp-la $lib |
2793 | + done |
2794 | + ${RM}r "$tmpdir" |
2795 | + fi |
2796 | + fi |
2797 | + |
2798 | + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
2799 | + for libdir in $libdirs; do |
2800 | + if test -n "$finish_cmds"; then |
2801 | + # Do each command in the finish commands. |
2802 | + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
2803 | +'"$cmd"'"' |
2804 | + fi |
2805 | + if test -n "$finish_eval"; then |
2806 | + # Do the single finish_eval. |
2807 | + eval cmds=\"$finish_eval\" |
2808 | + $opt_dry_run || eval "$cmds" || func_append admincmds " |
2809 | + $cmds" |
2810 | + fi |
2811 | + done |
2812 | + fi |
2813 | + |
2814 | + # Exit here if they wanted silent mode. |
2815 | + $opt_silent && exit $EXIT_SUCCESS |
2816 | + |
2817 | + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
2818 | + echo "----------------------------------------------------------------------" |
2819 | + echo "Libraries have been installed in:" |
2820 | + for libdir in $libdirs; do |
2821 | + $ECHO " $libdir" |
2822 | + done |
2823 | + echo |
2824 | + echo "If you ever happen to want to link against installed libraries" |
2825 | + echo "in a given directory, LIBDIR, you must either use libtool, and" |
2826 | + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
2827 | + echo "flag during linking and do at least one of the following:" |
2828 | + if test -n "$shlibpath_var"; then |
2829 | + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
2830 | + echo " during execution" |
2831 | + fi |
2832 | + if test -n "$runpath_var"; then |
2833 | + echo " - add LIBDIR to the \`$runpath_var' environment variable" |
2834 | + echo " during linking" |
2835 | + fi |
2836 | + if test -n "$hardcode_libdir_flag_spec"; then |
2837 | + libdir=LIBDIR |
2838 | + eval flag=\"$hardcode_libdir_flag_spec\" |
2839 | + |
2840 | + $ECHO " - use the \`$flag' linker flag" |
2841 | + fi |
2842 | + if test -n "$admincmds"; then |
2843 | + $ECHO " - have your system administrator run these commands:$admincmds" |
2844 | + fi |
2845 | + if test -f /etc/ld.so.conf; then |
2846 | + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
2847 | + fi |
2848 | + echo |
2849 | + |
2850 | + echo "See any operating system documentation about shared libraries for" |
2851 | + case $host in |
2852 | + solaris2.[6789]|solaris2.1[0-9]) |
2853 | + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
2854 | + echo "pages." |
2855 | + ;; |
2856 | + *) |
2857 | + echo "more information, such as the ld(1) and ld.so(8) manual pages." |
2858 | + ;; |
2859 | + esac |
2860 | + echo "----------------------------------------------------------------------" |
2861 | + fi |
2862 | + exit $EXIT_SUCCESS |
2863 | +} |
2864 | + |
2865 | +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} |
2866 | + |
2867 | + |
2868 | +# func_mode_install arg... |
2869 | +func_mode_install () |
2870 | +{ |
2871 | + $opt_debug |
2872 | + # There may be an optional sh(1) argument at the beginning of |
2873 | + # install_prog (especially on Windows NT). |
2874 | + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
2875 | + # Allow the use of GNU shtool's install command. |
2876 | + case $nonopt in *shtool*) :;; *) false;; esac; then |
2877 | + # Aesthetically quote it. |
2878 | + func_quote_for_eval "$nonopt" |
2879 | + install_prog="$func_quote_for_eval_result " |
2880 | + arg=$1 |
2881 | + shift |
2882 | + else |
2883 | + install_prog= |
2884 | + arg=$nonopt |
2885 | + fi |
2886 | + |
2887 | + # The real first argument should be the name of the installation program. |
2888 | + # Aesthetically quote it. |
2889 | + func_quote_for_eval "$arg" |
2890 | + func_append install_prog "$func_quote_for_eval_result" |
2891 | + install_shared_prog=$install_prog |
2892 | + case " $install_prog " in |
2893 | + *[\\\ /]cp\ *) install_cp=: ;; |
2894 | + *) install_cp=false ;; |
2895 | + esac |
2896 | + |
2897 | + # We need to accept at least all the BSD install flags. |
2898 | + dest= |
2899 | + files= |
2900 | + opts= |
2901 | + prev= |
2902 | + install_type= |
2903 | + isdir=no |
2904 | + stripme= |
2905 | + no_mode=: |
2906 | + for arg |
2907 | + do |
2908 | + arg2= |
2909 | + if test -n "$dest"; then |
2910 | + func_append files " $dest" |
2911 | + dest=$arg |
2912 | + continue |
2913 | + fi |
2914 | + |
2915 | + case $arg in |
2916 | + -d) isdir=yes ;; |
2917 | + -f) |
2918 | + if $install_cp; then :; else |
2919 | + prev=$arg |
2920 | + fi |
2921 | + ;; |
2922 | + -g | -m | -o) |
2923 | + prev=$arg |
2924 | + ;; |
2925 | + -s) |
2926 | + stripme=" -s" |
2927 | + continue |
2928 | + ;; |
2929 | + -*) |
2930 | + ;; |
2931 | + *) |
2932 | + # If the previous option needed an argument, then skip it. |
2933 | + if test -n "$prev"; then |
2934 | + if test "x$prev" = x-m && test -n "$install_override_mode"; then |
2935 | + arg2=$install_override_mode |
2936 | + no_mode=false |
2937 | + fi |
2938 | + prev= |
2939 | + else |
2940 | + dest=$arg |
2941 | + continue |
2942 | + fi |
2943 | + ;; |
2944 | + esac |
2945 | + |
2946 | + # Aesthetically quote the argument. |
2947 | + func_quote_for_eval "$arg" |
2948 | + func_append install_prog " $func_quote_for_eval_result" |
2949 | + if test -n "$arg2"; then |
2950 | + func_quote_for_eval "$arg2" |
2951 | + fi |
2952 | + func_append install_shared_prog " $func_quote_for_eval_result" |
2953 | + done |
2954 | + |
2955 | + test -z "$install_prog" && \ |
2956 | + func_fatal_help "you must specify an install program" |
2957 | + |
2958 | + test -n "$prev" && \ |
2959 | + func_fatal_help "the \`$prev' option requires an argument" |
2960 | + |
2961 | + if test -n "$install_override_mode" && $no_mode; then |
2962 | + if $install_cp; then :; else |
2963 | + func_quote_for_eval "$install_override_mode" |
2964 | + func_append install_shared_prog " -m $func_quote_for_eval_result" |
2965 | + fi |
2966 | + fi |
2967 | + |
2968 | + if test -z "$files"; then |
2969 | + if test -z "$dest"; then |
2970 | + func_fatal_help "no file or destination specified" |
2971 | + else |
2972 | + func_fatal_help "you must specify a destination" |
2973 | + fi |
2974 | + fi |
2975 | + |
2976 | + # Strip any trailing slash from the destination. |
2977 | + func_stripname '' '/' "$dest" |
2978 | + dest=$func_stripname_result |
2979 | + |
2980 | + # Check to see that the destination is a directory. |
2981 | + test -d "$dest" && isdir=yes |
2982 | + if test "$isdir" = yes; then |
2983 | + destdir="$dest" |
2984 | + destname= |
2985 | + else |
2986 | + func_dirname_and_basename "$dest" "" "." |
2987 | + destdir="$func_dirname_result" |
2988 | + destname="$func_basename_result" |
2989 | + |
2990 | + # Not a directory, so check to see that there is only one file specified. |
2991 | + set dummy $files; shift |
2992 | + test "$#" -gt 1 && \ |
2993 | + func_fatal_help "\`$dest' is not a directory" |
2994 | + fi |
2995 | + case $destdir in |
2996 | + [\\/]* | [A-Za-z]:[\\/]*) ;; |
2997 | + *) |
2998 | + for file in $files; do |
2999 | + case $file in |
3000 | + *.lo) ;; |
3001 | + *) |
3002 | + func_fatal_help "\`$destdir' must be an absolute directory name" |
3003 | + ;; |
3004 | + esac |
3005 | + done |
3006 | + ;; |
3007 | + esac |
3008 | + |
3009 | + # This variable tells wrapper scripts just to set variables rather |
3010 | + # than running their programs. |
3011 | + libtool_install_magic="$magic" |
3012 | + |
3013 | + staticlibs= |
3014 | + future_libdirs= |
3015 | + current_libdirs= |
3016 | + for file in $files; do |
3017 | + |
3018 | + # Do each installation. |
3019 | + case $file in |
3020 | + *.$libext) |
3021 | + # Do the static libraries later. |
3022 | + func_append staticlibs " $file" |
3023 | + ;; |
3024 | + |
3025 | + *.la) |
3026 | + func_resolve_sysroot "$file" |
3027 | + file=$func_resolve_sysroot_result |
3028 | + |
3029 | + # Check to see that this really is a libtool archive. |
3030 | + func_lalib_unsafe_p "$file" \ |
3031 | + || func_fatal_help "\`$file' is not a valid libtool archive" |
3032 | + |
3033 | + library_names= |
3034 | + old_library= |
3035 | + relink_command= |
3036 | + func_source "$file" |
3037 | + |
3038 | + # Add the libdir to current_libdirs if it is the destination. |
3039 | + if test "X$destdir" = "X$libdir"; then |
3040 | + case "$current_libdirs " in |
3041 | + *" $libdir "*) ;; |
3042 | + *) func_append current_libdirs " $libdir" ;; |
3043 | + esac |
3044 | + else |
3045 | + # Note the libdir as a future libdir. |
3046 | + case "$future_libdirs " in |
3047 | + *" $libdir "*) ;; |
3048 | + *) func_append future_libdirs " $libdir" ;; |
3049 | + esac |
3050 | + fi |
3051 | + |
3052 | + func_dirname "$file" "/" "" |
3053 | + dir="$func_dirname_result" |
3054 | + func_append dir "$objdir" |
3055 | + |
3056 | + if test -n "$relink_command"; then |
3057 | + # Determine the prefix the user has applied to our future dir. |
3058 | + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
3059 | + |
3060 | + # Don't allow the user to place us outside of our expected |
3061 | + # location b/c this prevents finding dependent libraries that |
3062 | + # are installed to the same prefix. |
3063 | + # At present, this check doesn't affect windows .dll's that |
3064 | + # are installed into $libdir/../bin (currently, that works fine) |
3065 | + # but it's something to keep an eye on. |
3066 | + test "$inst_prefix_dir" = "$destdir" && \ |
3067 | + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
3068 | + |
3069 | + if test -n "$inst_prefix_dir"; then |
3070 | + # Stick the inst_prefix_dir data into the link command. |
3071 | + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
3072 | + else |
3073 | + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
3074 | + fi |
3075 | + |
3076 | + func_warning "relinking \`$file'" |
3077 | + func_show_eval "$relink_command" \ |
3078 | + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
3079 | + fi |
3080 | + |
3081 | + # See the names of the shared library. |
3082 | + set dummy $library_names; shift |
3083 | + if test -n "$1"; then |
3084 | + realname="$1" |
3085 | + shift |
3086 | + |
3087 | + srcname="$realname" |
3088 | + test -n "$relink_command" && srcname="$realname"T |
3089 | + |
3090 | + # Install the shared library and build the symlinks. |
3091 | + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
3092 | + 'exit $?' |
3093 | + tstripme="$stripme" |
3094 | + case $host_os in |
3095 | + cygwin* | mingw* | pw32* | cegcc*) |
3096 | + case $realname in |
3097 | + *.dll.a) |
3098 | + tstripme="" |
3099 | + ;; |
3100 | + esac |
3101 | + ;; |
3102 | + esac |
3103 | + if test -n "$tstripme" && test -n "$striplib"; then |
3104 | + func_show_eval "$striplib $destdir/$realname" 'exit $?' |
3105 | + fi |
3106 | + |
3107 | + if test "$#" -gt 0; then |
3108 | + # Delete the old symlinks, and create new ones. |
3109 | + # Try `ln -sf' first, because the `ln' binary might depend on |
3110 | + # the symlink we replace! Solaris /bin/ln does not understand -f, |
3111 | + # so we also need to try rm && ln -s. |
3112 | + for linkname |
3113 | + do |
3114 | + test "$linkname" != "$realname" \ |
3115 | + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
3116 | + done |
3117 | + fi |
3118 | + |
3119 | + # Do each command in the postinstall commands. |
3120 | + lib="$destdir/$realname" |
3121 | + func_execute_cmds "$postinstall_cmds" 'exit $?' |
3122 | + fi |
3123 | + |
3124 | + # Install the pseudo-library for information purposes. |
3125 | + func_basename "$file" |
3126 | + name="$func_basename_result" |
3127 | + instname="$dir/$name"i |
3128 | + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
3129 | + |
3130 | + # Maybe install the static library, too. |
3131 | + test -n "$old_library" && func_append staticlibs " $dir/$old_library" |
3132 | + ;; |
3133 | + |
3134 | + *.lo) |
3135 | + # Install (i.e. copy) a libtool object. |
3136 | + |
3137 | + # Figure out destination file name, if it wasn't already specified. |
3138 | + if test -n "$destname"; then |
3139 | + destfile="$destdir/$destname" |
3140 | + else |
3141 | + func_basename "$file" |
3142 | + destfile="$func_basename_result" |
3143 | + destfile="$destdir/$destfile" |
3144 | + fi |
3145 | + |
3146 | + # Deduce the name of the destination old-style object file. |
3147 | + case $destfile in |
3148 | + *.lo) |
3149 | + func_lo2o "$destfile" |
3150 | + staticdest=$func_lo2o_result |
3151 | + ;; |
3152 | + *.$objext) |
3153 | + staticdest="$destfile" |
3154 | + destfile= |
3155 | + ;; |
3156 | + *) |
3157 | + func_fatal_help "cannot copy a libtool object to \`$destfile'" |
3158 | + ;; |
3159 | + esac |
3160 | + |
3161 | + # Install the libtool object if requested. |
3162 | + test -n "$destfile" && \ |
3163 | + func_show_eval "$install_prog $file $destfile" 'exit $?' |
3164 | + |
3165 | + # Install the old object if enabled. |
3166 | + if test "$build_old_libs" = yes; then |
3167 | + # Deduce the name of the old-style object file. |
3168 | + func_lo2o "$file" |
3169 | + staticobj=$func_lo2o_result |
3170 | + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
3171 | + fi |
3172 | + exit $EXIT_SUCCESS |
3173 | + ;; |
3174 | + |
3175 | + *) |
3176 | + # Figure out destination file name, if it wasn't already specified. |
3177 | + if test -n "$destname"; then |
3178 | + destfile="$destdir/$destname" |
3179 | + else |
3180 | + func_basename "$file" |
3181 | + destfile="$func_basename_result" |
3182 | + destfile="$destdir/$destfile" |
3183 | + fi |
3184 | + |
3185 | + # If the file is missing, and there is a .exe on the end, strip it |
3186 | + # because it is most likely a libtool script we actually want to |
3187 | + # install |
3188 | + stripped_ext="" |
3189 | + case $file in |
3190 | + *.exe) |
3191 | + if test ! -f "$file"; then |
3192 | + func_stripname '' '.exe' "$file" |
3193 | + file=$func_stripname_result |
3194 | + stripped_ext=".exe" |
3195 | + fi |
3196 | + ;; |
3197 | + esac |
3198 | + |
3199 | + # Do a test to see if this is really a libtool program. |
3200 | + case $host in |
3201 | + *cygwin* | *mingw*) |
3202 | + if func_ltwrapper_executable_p "$file"; then |
3203 | + func_ltwrapper_scriptname "$file" |
3204 | + wrapper=$func_ltwrapper_scriptname_result |
3205 | + else |
3206 | + func_stripname '' '.exe' "$file" |
3207 | + wrapper=$func_stripname_result |
3208 | + fi |
3209 | + ;; |
3210 | + *) |
3211 | + wrapper=$file |
3212 | + ;; |
3213 | + esac |
3214 | + if func_ltwrapper_script_p "$wrapper"; then |
3215 | + notinst_deplibs= |
3216 | + relink_command= |
3217 | + |
3218 | + func_source "$wrapper" |
3219 | + |
3220 | + # Check the variables that should have been set. |
3221 | + test -z "$generated_by_libtool_version" && \ |
3222 | + func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
3223 | + |
3224 | + finalize=yes |
3225 | + for lib in $notinst_deplibs; do |
3226 | + # Check to see that each library is installed. |
3227 | + libdir= |
3228 | + if test -f "$lib"; then |
3229 | + func_source "$lib" |
3230 | + fi |
3231 | + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test |
3232 | + if test -n "$libdir" && test ! -f "$libfile"; then |
3233 | + func_warning "\`$lib' has not been installed in \`$libdir'" |
3234 | + finalize=no |
3235 | + fi |
3236 | + done |
3237 | + |
3238 | + relink_command= |
3239 | + func_source "$wrapper" |
3240 | + |
3241 | + outputname= |
3242 | + if test "$fast_install" = no && test -n "$relink_command"; then |
3243 | + $opt_dry_run || { |
3244 | + if test "$finalize" = yes; then |
3245 | + tmpdir=`func_mktempdir` |
3246 | + func_basename "$file$stripped_ext" |
3247 | + file="$func_basename_result" |
3248 | + outputname="$tmpdir/$file" |
3249 | + # Replace the output file specification. |
3250 | + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
3251 | + |
3252 | + $opt_silent || { |
3253 | + func_quote_for_expand "$relink_command" |
3254 | + eval "func_echo $func_quote_for_expand_result" |
3255 | + } |
3256 | + if eval "$relink_command"; then : |
3257 | + else |
3258 | + func_error "error: relink \`$file' with the above command before installing it" |
3259 | + $opt_dry_run || ${RM}r "$tmpdir" |
3260 | + continue |
3261 | + fi |
3262 | + file="$outputname" |
3263 | + else |
3264 | + func_warning "cannot relink \`$file'" |
3265 | + fi |
3266 | + } |
3267 | + else |
3268 | + # Install the binary that we compiled earlier. |
3269 | + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
3270 | + fi |
3271 | + fi |
3272 | + |
3273 | + # remove .exe since cygwin /usr/bin/install will append another |
3274 | + # one anyway |
3275 | + case $install_prog,$host in |
3276 | + */usr/bin/install*,*cygwin*) |
3277 | + case $file:$destfile in |
3278 | + *.exe:*.exe) |
3279 | + # this is ok |
3280 | + ;; |
3281 | + *.exe:*) |
3282 | + destfile=$destfile.exe |
3283 | + ;; |
3284 | + *:*.exe) |
3285 | + func_stripname '' '.exe' "$destfile" |
3286 | + destfile=$func_stripname_result |
3287 | + ;; |
3288 | + esac |
3289 | + ;; |
3290 | + esac |
3291 | + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
3292 | + $opt_dry_run || if test -n "$outputname"; then |
3293 | + ${RM}r "$tmpdir" |
3294 | + fi |
3295 | + ;; |
3296 | + esac |
3297 | + done |
3298 | + |
3299 | + for file in $staticlibs; do |
3300 | + func_basename "$file" |
3301 | + name="$func_basename_result" |
3302 | + |
3303 | + # Set up the ranlib parameters. |
3304 | + oldlib="$destdir/$name" |
3305 | + |
3306 | + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
3307 | + |
3308 | + if test -n "$stripme" && test -n "$old_striplib"; then |
3309 | + func_show_eval "$old_striplib $oldlib" 'exit $?' |
3310 | + fi |
3311 | + |
3312 | + # Do each command in the postinstall commands. |
3313 | + func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
3314 | + done |
3315 | + |
3316 | + test -n "$future_libdirs" && \ |
3317 | + func_warning "remember to run \`$progname --finish$future_libdirs'" |
3318 | + |
3319 | + if test -n "$current_libdirs"; then |
3320 | + # Maybe just do a dry run. |
3321 | + $opt_dry_run && current_libdirs=" -n$current_libdirs" |
3322 | + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
3323 | + else |
3324 | + exit $EXIT_SUCCESS |
3325 | + fi |
3326 | +} |
3327 | + |
3328 | +test "$opt_mode" = install && func_mode_install ${1+"$@"} |
3329 | + |
3330 | + |
3331 | +# func_generate_dlsyms outputname originator pic_p |
3332 | +# Extract symbols from dlprefiles and create ${outputname}S.o with |
3333 | +# a dlpreopen symbol table. |
3334 | +func_generate_dlsyms () |
3335 | +{ |
3336 | + $opt_debug |
3337 | + my_outputname="$1" |
3338 | + my_originator="$2" |
3339 | + my_pic_p="${3-no}" |
3340 | + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
3341 | + my_dlsyms= |
3342 | + |
3343 | + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
3344 | + if test -n "$NM" && test -n "$global_symbol_pipe"; then |
3345 | + my_dlsyms="${my_outputname}S.c" |
3346 | + else |
3347 | + func_error "not configured to extract global symbols from dlpreopened files" |
3348 | + fi |
3349 | + fi |
3350 | + |
3351 | + if test -n "$my_dlsyms"; then |
3352 | + case $my_dlsyms in |
3353 | + "") ;; |
3354 | + *.c) |
3355 | + # Discover the nlist of each of the dlfiles. |
3356 | + nlist="$output_objdir/${my_outputname}.nm" |
3357 | + |
3358 | + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
3359 | + |
3360 | + # Parse the name list into a source file. |
3361 | + func_verbose "creating $output_objdir/$my_dlsyms" |
3362 | + |
3363 | + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
3364 | +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
3365 | +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
3366 | + |
3367 | +#ifdef __cplusplus |
3368 | +extern \"C\" { |
3369 | +#endif |
3370 | + |
3371 | +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
3372 | +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
3373 | +#endif |
3374 | + |
3375 | +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ |
3376 | +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) |
3377 | +/* DATA imports from DLLs on WIN32 con't be const, because runtime |
3378 | + relocations are performed -- see ld's documentation on pseudo-relocs. */ |
3379 | +# define LT_DLSYM_CONST |
3380 | +#elif defined(__osf__) |
3381 | +/* This system does not cope well with relocations in const data. */ |
3382 | +# define LT_DLSYM_CONST |
3383 | +#else |
3384 | +# define LT_DLSYM_CONST const |
3385 | +#endif |
3386 | + |
3387 | +/* External symbol declarations for the compiler. */\ |
3388 | +" |
3389 | + |
3390 | + if test "$dlself" = yes; then |
3391 | + func_verbose "generating symbol list for \`$output'" |
3392 | + |
3393 | + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
3394 | + |
3395 | + # Add our own program objects to the symbol list. |
3396 | + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
3397 | + for progfile in $progfiles; do |
3398 | + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 |
3399 | + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" |
3400 | + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" |
3401 | + done |
3402 | + |
3403 | + if test -n "$exclude_expsyms"; then |
3404 | + $opt_dry_run || { |
3405 | + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
3406 | + eval '$MV "$nlist"T "$nlist"' |
3407 | + } |
3408 | + fi |
3409 | + |
3410 | + if test -n "$export_symbols_regex"; then |
3411 | + $opt_dry_run || { |
3412 | + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
3413 | + eval '$MV "$nlist"T "$nlist"' |
3414 | + } |
3415 | + fi |
3416 | + |
3417 | + # Prepare the list of exported symbols |
3418 | + if test -z "$export_symbols"; then |
3419 | + export_symbols="$output_objdir/$outputname.exp" |
3420 | + $opt_dry_run || { |
3421 | + $RM $export_symbols |
3422 | + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
3423 | + case $host in |
3424 | + *cygwin* | *mingw* | *cegcc* ) |
3425 | + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
3426 | + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
3427 | + ;; |
3428 | + esac |
3429 | + } |
3430 | + else |
3431 | + $opt_dry_run || { |
3432 | + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
3433 | + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
3434 | + eval '$MV "$nlist"T "$nlist"' |
3435 | + case $host in |
3436 | + *cygwin* | *mingw* | *cegcc* ) |
3437 | + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
3438 | + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
3439 | + ;; |
3440 | + esac |
3441 | + } |
3442 | + fi |
3443 | + fi |
3444 | + |
3445 | + for dlprefile in $dlprefiles; do |
3446 | + func_verbose "extracting global C symbols from \`$dlprefile'" |
3447 | + func_basename "$dlprefile" |
3448 | + name="$func_basename_result" |
3449 | + case $host in |
3450 | + *cygwin* | *mingw* | *cegcc* ) |
3451 | + # if an import library, we need to obtain dlname |
3452 | + if func_win32_import_lib_p "$dlprefile"; then |
3453 | + func_tr_sh "$dlprefile" |
3454 | + eval "curr_lafile=\$libfile_$func_tr_sh_result" |
3455 | + dlprefile_dlbasename="" |
3456 | + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then |
3457 | + # Use subshell, to avoid clobbering current variable values |
3458 | + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` |
3459 | + if test -n "$dlprefile_dlname" ; then |
3460 | + func_basename "$dlprefile_dlname" |
3461 | + dlprefile_dlbasename="$func_basename_result" |
3462 | + else |
3463 | + # no lafile. user explicitly requested -dlpreopen <import library>. |
3464 | + $sharedlib_from_linklib_cmd "$dlprefile" |
3465 | + dlprefile_dlbasename=$sharedlib_from_linklib_result |
3466 | + fi |
3467 | + fi |
3468 | + $opt_dry_run || { |
3469 | + if test -n "$dlprefile_dlbasename" ; then |
3470 | + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' |
3471 | + else |
3472 | + func_warning "Could not compute DLL name from $name" |
3473 | + eval '$ECHO ": $name " >> "$nlist"' |
3474 | + fi |
3475 | + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
3476 | + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | |
3477 | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" |
3478 | + } |
3479 | + else # not an import lib |
3480 | + $opt_dry_run || { |
3481 | + eval '$ECHO ": $name " >> "$nlist"' |
3482 | + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
3483 | + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
3484 | + } |
3485 | + fi |
3486 | + ;; |
3487 | + *) |
3488 | + $opt_dry_run || { |
3489 | + eval '$ECHO ": $name " >> "$nlist"' |
3490 | + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 |
3491 | + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
3492 | + } |
3493 | + ;; |
3494 | + esac |
3495 | + done |
3496 | + |
3497 | + $opt_dry_run || { |
3498 | + # Make sure we have at least an empty file. |
3499 | + test -f "$nlist" || : > "$nlist" |
3500 | + |
3501 | + if test -n "$exclude_expsyms"; then |
3502 | + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
3503 | + $MV "$nlist"T "$nlist" |
3504 | + fi |
3505 | + |
3506 | + # Try sorting and uniquifying the output. |
3507 | + if $GREP -v "^: " < "$nlist" | |
3508 | + if sort -k 3 </dev/null >/dev/null 2>&1; then |
3509 | + sort -k 3 |
3510 | + else |
3511 | + sort +2 |
3512 | + fi | |
3513 | + uniq > "$nlist"S; then |
3514 | + : |
3515 | + else |
3516 | + $GREP -v "^: " < "$nlist" > "$nlist"S |
3517 | + fi |
3518 | + |
3519 | + if test -f "$nlist"S; then |
3520 | + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
3521 | + else |
3522 | + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
3523 | + fi |
3524 | + |
3525 | + echo >> "$output_objdir/$my_dlsyms" "\ |
3526 | + |
3527 | +/* The mapping between symbol names and symbols. */ |
3528 | +typedef struct { |
3529 | + const char *name; |
3530 | + void *address; |
3531 | +} lt_dlsymlist; |
3532 | +extern LT_DLSYM_CONST lt_dlsymlist |
3533 | +lt_${my_prefix}_LTX_preloaded_symbols[]; |
3534 | +LT_DLSYM_CONST lt_dlsymlist |
3535 | +lt_${my_prefix}_LTX_preloaded_symbols[] = |
3536 | +{\ |
3537 | + { \"$my_originator\", (void *) 0 }," |
3538 | + |
3539 | + case $need_lib_prefix in |
3540 | + no) |
3541 | + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
3542 | + ;; |
3543 | + *) |
3544 | + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
3545 | + ;; |
3546 | + esac |
3547 | + echo >> "$output_objdir/$my_dlsyms" "\ |
3548 | + {0, (void *) 0} |
3549 | +}; |
3550 | + |
3551 | +/* This works around a problem in FreeBSD linker */ |
3552 | +#ifdef FREEBSD_WORKAROUND |
3553 | +static const void *lt_preloaded_setup() { |
3554 | + return lt_${my_prefix}_LTX_preloaded_symbols; |
3555 | +} |
3556 | +#endif |
3557 | + |
3558 | +#ifdef __cplusplus |
3559 | +} |
3560 | +#endif\ |
3561 | +" |
3562 | + } # !$opt_dry_run |
3563 | + |
3564 | + pic_flag_for_symtable= |
3565 | + case "$compile_command " in |
3566 | + *" -static "*) ;; |
3567 | + *) |
3568 | + case $host in |
3569 | + # compiling the symbol table file with pic_flag works around |
3570 | + # a FreeBSD bug that causes programs to crash when -lm is |
3571 | + # linked before any other PIC object. But we must not use |
3572 | + # pic_flag when linking with -static. The problem exists in |
3573 | + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
3574 | + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
3575 | + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
3576 | + *-*-hpux*) |
3577 | + pic_flag_for_symtable=" $pic_flag" ;; |
3578 | + *) |
3579 | + if test "X$my_pic_p" != Xno; then |
3580 | + pic_flag_for_symtable=" $pic_flag" |
3581 | + fi |
3582 | + ;; |
3583 | + esac |
3584 | + ;; |
3585 | + esac |
3586 | + symtab_cflags= |
3587 | + for arg in $LTCFLAGS; do |
3588 | + case $arg in |
3589 | + -pie | -fpie | -fPIE) ;; |
3590 | + *) func_append symtab_cflags " $arg" ;; |
3591 | + esac |
3592 | + done |
3593 | + |
3594 | + # Now compile the dynamic symbol file. |
3595 | + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
3596 | + |
3597 | + # Clean up the generated files. |
3598 | + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
3599 | + |
3600 | + # Transform the symbol file into the correct name. |
3601 | + symfileobj="$output_objdir/${my_outputname}S.$objext" |
3602 | + case $host in |
3603 | + *cygwin* | *mingw* | *cegcc* ) |
3604 | + if test -f "$output_objdir/$my_outputname.def"; then |
3605 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
3606 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
3607 | + else |
3608 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
3609 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
3610 | + fi |
3611 | + ;; |
3612 | + *) |
3613 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
3614 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
3615 | + ;; |
3616 | + esac |
3617 | + ;; |
3618 | + *) |
3619 | + func_fatal_error "unknown suffix for \`$my_dlsyms'" |
3620 | + ;; |
3621 | + esac |
3622 | + else |
3623 | + # We keep going just in case the user didn't refer to |
3624 | + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
3625 | + # really was required. |
3626 | + |
3627 | + # Nullify the symbol file. |
3628 | + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
3629 | + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
3630 | + fi |
3631 | +} |
3632 | + |
3633 | +# func_win32_libid arg |
3634 | +# return the library type of file 'arg' |
3635 | +# |
3636 | +# Need a lot of goo to handle *both* DLLs and import libs |
3637 | +# Has to be a shell function in order to 'eat' the argument |
3638 | +# that is supplied when $file_magic_command is called. |
3639 | +# Despite the name, also deal with 64 bit binaries. |
3640 | +func_win32_libid () |
3641 | +{ |
3642 | + $opt_debug |
3643 | + win32_libid_type="unknown" |
3644 | + win32_fileres=`file -L $1 2>/dev/null` |
3645 | + case $win32_fileres in |
3646 | + *ar\ archive\ import\ library*) # definitely import |
3647 | + win32_libid_type="x86 archive import" |
3648 | + ;; |
3649 | + *ar\ archive*) # could be an import, or static |
3650 | + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
3651 | + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
3652 | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
3653 | + func_to_tool_file "$1" func_convert_file_msys_to_w32 |
3654 | + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | |
3655 | + $SED -n -e ' |
3656 | + 1,100{ |
3657 | + / I /{ |
3658 | + s,.*,import, |
3659 | + p |
3660 | + q |
3661 | + } |
3662 | + }'` |
3663 | + case $win32_nmres in |
3664 | + import*) win32_libid_type="x86 archive import";; |
3665 | + *) win32_libid_type="x86 archive static";; |
3666 | + esac |
3667 | + fi |
3668 | + ;; |
3669 | + *DLL*) |
3670 | + win32_libid_type="x86 DLL" |
3671 | + ;; |
3672 | + *executable*) # but shell scripts are "executable" too... |
3673 | + case $win32_fileres in |
3674 | + *MS\ Windows\ PE\ Intel*) |
3675 | + win32_libid_type="x86 DLL" |
3676 | + ;; |
3677 | + esac |
3678 | + ;; |
3679 | + esac |
3680 | + $ECHO "$win32_libid_type" |
3681 | +} |
3682 | + |
3683 | +# func_cygming_dll_for_implib ARG |
3684 | +# |
3685 | +# Platform-specific function to extract the |
3686 | +# name of the DLL associated with the specified |
3687 | +# import library ARG. |
3688 | +# Invoked by eval'ing the libtool variable |
3689 | +# $sharedlib_from_linklib_cmd |
3690 | +# Result is available in the variable |
3691 | +# $sharedlib_from_linklib_result |
3692 | +func_cygming_dll_for_implib () |
3693 | +{ |
3694 | + $opt_debug |
3695 | + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` |
3696 | +} |
3697 | + |
3698 | +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs |
3699 | +# |
3700 | +# The is the core of a fallback implementation of a |
3701 | +# platform-specific function to extract the name of the |
3702 | +# DLL associated with the specified import library LIBNAME. |
3703 | +# |
3704 | +# SECTION_NAME is either .idata$6 or .idata$7, depending |
3705 | +# on the platform and compiler that created the implib. |
3706 | +# |
3707 | +# Echos the name of the DLL associated with the |
3708 | +# specified import library. |
3709 | +func_cygming_dll_for_implib_fallback_core () |
3710 | +{ |
3711 | + $opt_debug |
3712 | + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` |
3713 | + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | |
3714 | + $SED '/^Contents of section '"$match_literal"':/{ |
3715 | + # Place marker at beginning of archive member dllname section |
3716 | + s/.*/====MARK====/ |
3717 | + p |
3718 | + d |
3719 | + } |
3720 | + # These lines can sometimes be longer than 43 characters, but |
3721 | + # are always uninteresting |
3722 | + /:[ ]*file format pe[i]\{,1\}-/d |
3723 | + /^In archive [^:]*:/d |
3724 | + # Ensure marker is printed |
3725 | + /^====MARK====/p |
3726 | + # Remove all lines with less than 43 characters |
3727 | + /^.\{43\}/!d |
3728 | + # From remaining lines, remove first 43 characters |
3729 | + s/^.\{43\}//' | |
3730 | + $SED -n ' |
3731 | + # Join marker and all lines until next marker into a single line |
3732 | + /^====MARK====/ b para |
3733 | + H |
3734 | + $ b para |
3735 | + b |
3736 | + :para |
3737 | + x |
3738 | + s/\n//g |
3739 | + # Remove the marker |
3740 | + s/^====MARK====// |
3741 | + # Remove trailing dots and whitespace |
3742 | + s/[\. \t]*$// |
3743 | |
3744 | + /./p' | |
3745 | + # we now have a list, one entry per line, of the stringified |
3746 | + # contents of the appropriate section of all members of the |
3747 | + # archive which possess that section. Heuristic: eliminate |
3748 | + # all those which have a first or second character that is |
3749 | + # a '.' (that is, objdump's representation of an unprintable |
3750 | + # character.) This should work for all archives with less than |
3751 | + # 0x302f exports -- but will fail for DLLs whose name actually |
3752 | + # begins with a literal '.' or a single character followed by |
3753 | + # a '.'. |
3754 | + # |
3755 | + # Of those that remain, print the first one. |
3756 | + $SED -e '/^\./d;/^.\./d;q' |
3757 | +} |
3758 | + |
3759 | +# func_cygming_gnu_implib_p ARG |
3760 | +# This predicate returns with zero status (TRUE) if |
3761 | +# ARG is a GNU/binutils-style import library. Returns |
3762 | +# with nonzero status (FALSE) otherwise. |
3763 | +func_cygming_gnu_implib_p () |
3764 | +{ |
3765 | + $opt_debug |
3766 | + func_to_tool_file "$1" func_convert_file_msys_to_w32 |
3767 | + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` |
3768 | + test -n "$func_cygming_gnu_implib_tmp" |
3769 | +} |
3770 | + |
3771 | +# func_cygming_ms_implib_p ARG |
3772 | +# This predicate returns with zero status (TRUE) if |
3773 | +# ARG is an MS-style import library. Returns |
3774 | +# with nonzero status (FALSE) otherwise. |
3775 | +func_cygming_ms_implib_p () |
3776 | +{ |
3777 | + $opt_debug |
3778 | + func_to_tool_file "$1" func_convert_file_msys_to_w32 |
3779 | + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` |
3780 | + test -n "$func_cygming_ms_implib_tmp" |
3781 | +} |
3782 | + |
3783 | +# func_cygming_dll_for_implib_fallback ARG |
3784 | +# Platform-specific function to extract the |
3785 | +# name of the DLL associated with the specified |
3786 | +# import library ARG. |
3787 | +# |
3788 | +# This fallback implementation is for use when $DLLTOOL |
3789 | +# does not support the --identify-strict option. |
3790 | +# Invoked by eval'ing the libtool variable |
3791 | +# $sharedlib_from_linklib_cmd |
3792 | +# Result is available in the variable |
3793 | +# $sharedlib_from_linklib_result |
3794 | +func_cygming_dll_for_implib_fallback () |
3795 | +{ |
3796 | + $opt_debug |
3797 | + if func_cygming_gnu_implib_p "$1" ; then |
3798 | + # binutils import library |
3799 | + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` |
3800 | + elif func_cygming_ms_implib_p "$1" ; then |
3801 | + # ms-generated import library |
3802 | + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` |
3803 | + else |
3804 | + # unknown |
3805 | + sharedlib_from_linklib_result="" |
3806 | + fi |
3807 | +} |
3808 | + |
3809 | + |
3810 | +# func_extract_an_archive dir oldlib |
3811 | +func_extract_an_archive () |
3812 | +{ |
3813 | + $opt_debug |
3814 | + f_ex_an_ar_dir="$1"; shift |
3815 | + f_ex_an_ar_oldlib="$1" |
3816 | + if test "$lock_old_archive_extraction" = yes; then |
3817 | + lockfile=$f_ex_an_ar_oldlib.lock |
3818 | + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
3819 | + func_echo "Waiting for $lockfile to be removed" |
3820 | + sleep 2 |
3821 | + done |
3822 | + fi |
3823 | + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
3824 | + 'stat=$?; rm -f "$lockfile"; exit $stat' |
3825 | + if test "$lock_old_archive_extraction" = yes; then |
3826 | + $opt_dry_run || rm -f "$lockfile" |
3827 | + fi |
3828 | + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
3829 | + : |
3830 | + else |
3831 | + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
3832 | + fi |
3833 | +} |
3834 | + |
3835 | + |
3836 | +# func_extract_archives gentop oldlib ... |
3837 | +func_extract_archives () |
3838 | +{ |
3839 | + $opt_debug |
3840 | + my_gentop="$1"; shift |
3841 | + my_oldlibs=${1+"$@"} |
3842 | + my_oldobjs="" |
3843 | + my_xlib="" |
3844 | + my_xabs="" |
3845 | + my_xdir="" |
3846 | + |
3847 | + for my_xlib in $my_oldlibs; do |
3848 | + # Extract the objects. |
3849 | + case $my_xlib in |
3850 | + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
3851 | + *) my_xabs=`pwd`"/$my_xlib" ;; |
3852 | + esac |
3853 | + func_basename "$my_xlib" |
3854 | + my_xlib="$func_basename_result" |
3855 | + my_xlib_u=$my_xlib |
3856 | + while :; do |
3857 | + case " $extracted_archives " in |
3858 | + *" $my_xlib_u "*) |
3859 | + func_arith $extracted_serial + 1 |
3860 | + extracted_serial=$func_arith_result |
3861 | + my_xlib_u=lt$extracted_serial-$my_xlib ;; |
3862 | + *) break ;; |
3863 | + esac |
3864 | + done |
3865 | + extracted_archives="$extracted_archives $my_xlib_u" |
3866 | + my_xdir="$my_gentop/$my_xlib_u" |
3867 | + |
3868 | + func_mkdir_p "$my_xdir" |
3869 | + |
3870 | + case $host in |
3871 | + *-darwin*) |
3872 | + func_verbose "Extracting $my_xabs" |
3873 | + # Do not bother doing anything if just a dry run |
3874 | + $opt_dry_run || { |
3875 | + darwin_orig_dir=`pwd` |
3876 | + cd $my_xdir || exit $? |
3877 | + darwin_archive=$my_xabs |
3878 | + darwin_curdir=`pwd` |
3879 | + darwin_base_archive=`basename "$darwin_archive"` |
3880 | + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
3881 | + if test -n "$darwin_arches"; then |
3882 | + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
3883 | + darwin_arch= |
3884 | + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
3885 | + for darwin_arch in $darwin_arches ; do |
3886 | + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
3887 | + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
3888 | + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
3889 | + func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
3890 | + cd "$darwin_curdir" |
3891 | + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
3892 | + done # $darwin_arches |
3893 | + ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
3894 | + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
3895 | + darwin_file= |
3896 | + darwin_files= |
3897 | + for darwin_file in $darwin_filelist; do |
3898 | + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
3899 | + $LIPO -create -output "$darwin_file" $darwin_files |
3900 | + done # $darwin_filelist |
3901 | + $RM -rf unfat-$$ |
3902 | + cd "$darwin_orig_dir" |
3903 | + else |
3904 | + cd $darwin_orig_dir |
3905 | + func_extract_an_archive "$my_xdir" "$my_xabs" |
3906 | + fi # $darwin_arches |
3907 | + } # !$opt_dry_run |
3908 | + ;; |
3909 | + *) |
3910 | + func_extract_an_archive "$my_xdir" "$my_xabs" |
3911 | + ;; |
3912 | + esac |
3913 | + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
3914 | + done |
3915 | + |
3916 | + func_extract_archives_result="$my_oldobjs" |
3917 | +} |
3918 | + |
3919 | + |
3920 | +# func_emit_wrapper [arg=no] |
3921 | +# |
3922 | +# Emit a libtool wrapper script on stdout. |
3923 | +# Don't directly open a file because we may want to |
3924 | +# incorporate the script contents within a cygwin/mingw |
3925 | +# wrapper executable. Must ONLY be called from within |
3926 | +# func_mode_link because it depends on a number of variables |
3927 | +# set therein. |
3928 | +# |
3929 | +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
3930 | +# variable will take. If 'yes', then the emitted script |
3931 | +# will assume that the directory in which it is stored is |
3932 | +# the $objdir directory. This is a cygwin/mingw-specific |
3933 | +# behavior. |
3934 | +func_emit_wrapper () |
3935 | +{ |
3936 | + func_emit_wrapper_arg1=${1-no} |
3937 | + |
3938 | + $ECHO "\ |
3939 | +#! $SHELL |
3940 | + |
3941 | +# $output - temporary wrapper script for $objdir/$outputname |
3942 | +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
3943 | +# |
3944 | +# The $output program cannot be directly executed until all the libtool |
3945 | +# libraries that it depends on are installed. |
3946 | +# |
3947 | +# This wrapper script should never be moved out of the build directory. |
3948 | +# If it is, it will not operate correctly. |
3949 | + |
3950 | +# Sed substitution that helps us do robust quoting. It backslashifies |
3951 | +# metacharacters that are still active within double-quoted strings. |
3952 | +sed_quote_subst='$sed_quote_subst' |
3953 | + |
3954 | +# Be Bourne compatible |
3955 | +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
3956 | + emulate sh |
3957 | + NULLCMD=: |
3958 | + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
3959 | + # is contrary to our usage. Disable this feature. |
3960 | + alias -g '\${1+\"\$@\"}'='\"\$@\"' |
3961 | + setopt NO_GLOB_SUBST |
3962 | +else |
3963 | + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
3964 | +fi |
3965 | +BIN_SH=xpg4; export BIN_SH # for Tru64 |
3966 | +DUALCASE=1; export DUALCASE # for MKS sh |
3967 | + |
3968 | +# The HP-UX ksh and POSIX shell print the target directory to stdout |
3969 | +# if CDPATH is set. |
3970 | +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
3971 | + |
3972 | +relink_command=\"$relink_command\" |
3973 | + |
3974 | +# This environment variable determines our operation mode. |
3975 | +if test \"\$libtool_install_magic\" = \"$magic\"; then |
3976 | + # install mode needs the following variables: |
3977 | + generated_by_libtool_version='$macro_version' |
3978 | + notinst_deplibs='$notinst_deplibs' |
3979 | +else |
3980 | + # When we are sourced in execute mode, \$file and \$ECHO are already set. |
3981 | + if test \"\$libtool_execute_magic\" != \"$magic\"; then |
3982 | + file=\"\$0\"" |
3983 | + |
3984 | + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
3985 | + $ECHO "\ |
3986 | + |
3987 | +# A function that is used when there is no print builtin or printf. |
3988 | +func_fallback_echo () |
3989 | +{ |
3990 | + eval 'cat <<_LTECHO_EOF |
3991 | +\$1 |
3992 | +_LTECHO_EOF' |
3993 | +} |
3994 | + ECHO=\"$qECHO\" |
3995 | + fi |
3996 | + |
3997 | +# Very basic option parsing. These options are (a) specific to |
3998 | +# the libtool wrapper, (b) are identical between the wrapper |
3999 | +# /script/ and the wrapper /executable/ which is used only on |
4000 | +# windows platforms, and (c) all begin with the string "--lt-" |
4001 | +# (application programs are unlikely to have options which match |
4002 | +# this pattern). |
4003 | +# |
4004 | +# There are only two supported options: --lt-debug and |
4005 | +# --lt-dump-script. There is, deliberately, no --lt-help. |
4006 | +# |
4007 | +# The first argument to this parsing function should be the |
4008 | +# script's $0 value, followed by "$@". |
4009 | +lt_option_debug= |
4010 | +func_parse_lt_options () |
4011 | +{ |
4012 | + lt_script_arg0=\$0 |
4013 | + shift |
4014 | + for lt_opt |
4015 | + do |
4016 | + case \"\$lt_opt\" in |
4017 | + --lt-debug) lt_option_debug=1 ;; |
4018 | + --lt-dump-script) |
4019 | + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
4020 | + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
4021 | + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
4022 | + cat \"\$lt_dump_D/\$lt_dump_F\" |
4023 | + exit 0 |
4024 | + ;; |
4025 | + --lt-*) |
4026 | + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
4027 | + exit 1 |
4028 | + ;; |
4029 | + esac |
4030 | + done |
4031 | + |
4032 | + # Print the debug banner immediately: |
4033 | + if test -n \"\$lt_option_debug\"; then |
4034 | + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 |
4035 | + fi |
4036 | +} |
4037 | + |
4038 | +# Used when --lt-debug. Prints its arguments to stdout |
4039 | +# (redirection is the responsibility of the caller) |
4040 | +func_lt_dump_args () |
4041 | +{ |
4042 | + lt_dump_args_N=1; |
4043 | + for lt_arg |
4044 | + do |
4045 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" |
4046 | + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
4047 | + done |
4048 | +} |
4049 | + |
4050 | +# Core function for launching the target application |
4051 | +func_exec_program_core () |
4052 | +{ |
4053 | +" |
4054 | + case $host in |
4055 | + # Backslashes separate directories on plain windows |
4056 | + *-*-mingw | *-*-os2* | *-cegcc*) |
4057 | + $ECHO "\ |
4058 | + if test -n \"\$lt_option_debug\"; then |
4059 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
4060 | + func_lt_dump_args \${1+\"\$@\"} 1>&2 |
4061 | + fi |
4062 | + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
4063 | +" |
4064 | + ;; |
4065 | + |
4066 | + *) |
4067 | + $ECHO "\ |
4068 | + if test -n \"\$lt_option_debug\"; then |
4069 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 |
4070 | + func_lt_dump_args \${1+\"\$@\"} 1>&2 |
4071 | + fi |
4072 | + exec \"\$progdir/\$program\" \${1+\"\$@\"} |
4073 | +" |
4074 | + ;; |
4075 | + esac |
4076 | + $ECHO "\ |
4077 | + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
4078 | + exit 1 |
4079 | +} |
4080 | + |
4081 | +# A function to encapsulate launching the target application |
4082 | +# Strips options in the --lt-* namespace from \$@ and |
4083 | +# launches target application with the remaining arguments. |
4084 | +func_exec_program () |
4085 | +{ |
4086 | + for lt_wr_arg |
4087 | + do |
4088 | + case \$lt_wr_arg in |
4089 | + --lt-*) ;; |
4090 | + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
4091 | + esac |
4092 | + shift |
4093 | + done |
4094 | + func_exec_program_core \${1+\"\$@\"} |
4095 | +} |
4096 | + |
4097 | + # Parse options |
4098 | + func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
4099 | + |
4100 | + # Find the directory that this script lives in. |
4101 | + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
4102 | + test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
4103 | + |
4104 | + # Follow symbolic links until we get to the real thisdir. |
4105 | + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
4106 | + while test -n \"\$file\"; do |
4107 | + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
4108 | + |
4109 | + # If there was a directory component, then change thisdir. |
4110 | + if test \"x\$destdir\" != \"x\$file\"; then |
4111 | + case \"\$destdir\" in |
4112 | + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
4113 | + *) thisdir=\"\$thisdir/\$destdir\" ;; |
4114 | + esac |
4115 | + fi |
4116 | + |
4117 | + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
4118 | + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
4119 | + done |
4120 | + |
4121 | + # Usually 'no', except on cygwin/mingw when embedded into |
4122 | + # the cwrapper. |
4123 | + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
4124 | + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
4125 | + # special case for '.' |
4126 | + if test \"\$thisdir\" = \".\"; then |
4127 | + thisdir=\`pwd\` |
4128 | + fi |
4129 | + # remove .libs from thisdir |
4130 | + case \"\$thisdir\" in |
4131 | + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
4132 | + $objdir ) thisdir=. ;; |
4133 | + esac |
4134 | + fi |
4135 | + |
4136 | + # Try to get the absolute directory name. |
4137 | + absdir=\`cd \"\$thisdir\" && pwd\` |
4138 | + test -n \"\$absdir\" && thisdir=\"\$absdir\" |
4139 | +" |
4140 | + |
4141 | + if test "$fast_install" = yes; then |
4142 | + $ECHO "\ |
4143 | + program=lt-'$outputname'$exeext |
4144 | + progdir=\"\$thisdir/$objdir\" |
4145 | + |
4146 | + if test ! -f \"\$progdir/\$program\" || |
4147 | + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
4148 | + test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
4149 | + |
4150 | + file=\"\$\$-\$program\" |
4151 | + |
4152 | + if test ! -d \"\$progdir\"; then |
4153 | + $MKDIR \"\$progdir\" |
4154 | + else |
4155 | + $RM \"\$progdir/\$file\" |
4156 | + fi" |
4157 | + |
4158 | + $ECHO "\ |
4159 | + |
4160 | + # relink executable if necessary |
4161 | + if test -n \"\$relink_command\"; then |
4162 | + if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
4163 | + else |
4164 | + $ECHO \"\$relink_command_output\" >&2 |
4165 | + $RM \"\$progdir/\$file\" |
4166 | + exit 1 |
4167 | + fi |
4168 | + fi |
4169 | + |
4170 | + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
4171 | + { $RM \"\$progdir/\$program\"; |
4172 | + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
4173 | + $RM \"\$progdir/\$file\" |
4174 | + fi" |
4175 | + else |
4176 | + $ECHO "\ |
4177 | + program='$outputname' |
4178 | + progdir=\"\$thisdir/$objdir\" |
4179 | +" |
4180 | + fi |
4181 | + |
4182 | + $ECHO "\ |
4183 | + |
4184 | + if test -f \"\$progdir/\$program\"; then" |
4185 | + |
4186 | + # fixup the dll searchpath if we need to. |
4187 | + # |
4188 | + # Fix the DLL searchpath if we need to. Do this before prepending |
4189 | + # to shlibpath, because on Windows, both are PATH and uninstalled |
4190 | + # libraries must come first. |
4191 | + if test -n "$dllsearchpath"; then |
4192 | + $ECHO "\ |
4193 | + # Add the dll search path components to the executable PATH |
4194 | + PATH=$dllsearchpath:\$PATH |
4195 | +" |
4196 | + fi |
4197 | + |
4198 | + # Export our shlibpath_var if we have one. |
4199 | + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
4200 | + $ECHO "\ |
4201 | + # Add our own library path to $shlibpath_var |
4202 | + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
4203 | + |
4204 | + # Some systems cannot cope with colon-terminated $shlibpath_var |
4205 | + # The second colon is a workaround for a bug in BeOS R4 sed |
4206 | + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
4207 | + |
4208 | + export $shlibpath_var |
4209 | +" |
4210 | + fi |
4211 | + |
4212 | + $ECHO "\ |
4213 | + if test \"\$libtool_execute_magic\" != \"$magic\"; then |
4214 | + # Run the actual program with our arguments. |
4215 | + func_exec_program \${1+\"\$@\"} |
4216 | + fi |
4217 | + else |
4218 | + # The program doesn't exist. |
4219 | + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
4220 | + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
4221 | + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
4222 | + exit 1 |
4223 | + fi |
4224 | +fi\ |
4225 | +" |
4226 | +} |
4227 | + |
4228 | + |
4229 | +# func_emit_cwrapperexe_src |
4230 | +# emit the source code for a wrapper executable on stdout |
4231 | +# Must ONLY be called from within func_mode_link because |
4232 | +# it depends on a number of variable set therein. |
4233 | +func_emit_cwrapperexe_src () |
4234 | +{ |
4235 | + cat <<EOF |
4236 | + |
4237 | +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
4238 | + Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
4239 | + |
4240 | + The $output program cannot be directly executed until all the libtool |
4241 | + libraries that it depends on are installed. |
4242 | + |
4243 | + This wrapper executable should never be moved out of the build directory. |
4244 | + If it is, it will not operate correctly. |
4245 | +*/ |
4246 | +EOF |
4247 | + cat <<"EOF" |
4248 | +#ifdef _MSC_VER |
4249 | +# define _CRT_SECURE_NO_DEPRECATE 1 |
4250 | +#endif |
4251 | +#include <stdio.h> |
4252 | +#include <stdlib.h> |
4253 | +#ifdef _MSC_VER |
4254 | +# include <direct.h> |
4255 | +# include <process.h> |
4256 | +# include <io.h> |
4257 | +#else |
4258 | +# include <unistd.h> |
4259 | +# include <stdint.h> |
4260 | +# ifdef __CYGWIN__ |
4261 | +# include <io.h> |
4262 | +# endif |
4263 | +#endif |
4264 | +#include <malloc.h> |
4265 | +#include <stdarg.h> |
4266 | +#include <assert.h> |
4267 | +#include <string.h> |
4268 | +#include <ctype.h> |
4269 | +#include <errno.h> |
4270 | +#include <fcntl.h> |
4271 | +#include <sys/stat.h> |
4272 | + |
4273 | +/* declarations of non-ANSI functions */ |
4274 | +#if defined(__MINGW32__) |
4275 | +# ifdef __STRICT_ANSI__ |
4276 | +int _putenv (const char *); |
4277 | +# endif |
4278 | +#elif defined(__CYGWIN__) |
4279 | +# ifdef __STRICT_ANSI__ |
4280 | +char *realpath (const char *, char *); |
4281 | +int putenv (char *); |
4282 | +int setenv (const char *, const char *, int); |
4283 | +# endif |
4284 | +/* #elif defined (other platforms) ... */ |
4285 | +#endif |
4286 | + |
4287 | +/* portability defines, excluding path handling macros */ |
4288 | +#if defined(_MSC_VER) |
4289 | +# define setmode _setmode |
4290 | +# define stat _stat |
4291 | +# define chmod _chmod |
4292 | +# define getcwd _getcwd |
4293 | +# define putenv _putenv |
4294 | +# define S_IXUSR _S_IEXEC |
4295 | +# ifndef _INTPTR_T_DEFINED |
4296 | +# define _INTPTR_T_DEFINED |
4297 | +# define intptr_t int |
4298 | +# endif |
4299 | +#elif defined(__MINGW32__) |
4300 | +# define setmode _setmode |
4301 | +# define stat _stat |
4302 | +# define chmod _chmod |
4303 | +# define getcwd _getcwd |
4304 | +# define putenv _putenv |
4305 | +#elif defined(__CYGWIN__) |
4306 | +# define HAVE_SETENV |
4307 | +# define FOPEN_WB "wb" |
4308 | +/* #elif defined (other platforms) ... */ |
4309 | +#endif |
4310 | + |
4311 | +#if defined(PATH_MAX) |
4312 | +# define LT_PATHMAX PATH_MAX |
4313 | +#elif defined(MAXPATHLEN) |
4314 | +# define LT_PATHMAX MAXPATHLEN |
4315 | +#else |
4316 | +# define LT_PATHMAX 1024 |
4317 | +#endif |
4318 | + |
4319 | +#ifndef S_IXOTH |
4320 | +# define S_IXOTH 0 |
4321 | +#endif |
4322 | +#ifndef S_IXGRP |
4323 | +# define S_IXGRP 0 |
4324 | +#endif |
4325 | + |
4326 | +/* path handling portability macros */ |
4327 | +#ifndef DIR_SEPARATOR |
4328 | +# define DIR_SEPARATOR '/' |
4329 | +# define PATH_SEPARATOR ':' |
4330 | +#endif |
4331 | + |
4332 | +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
4333 | + defined (__OS2__) |
4334 | +# define HAVE_DOS_BASED_FILE_SYSTEM |
4335 | +# define FOPEN_WB "wb" |
4336 | +# ifndef DIR_SEPARATOR_2 |
4337 | +# define DIR_SEPARATOR_2 '\\' |
4338 | +# endif |
4339 | +# ifndef PATH_SEPARATOR_2 |
4340 | +# define PATH_SEPARATOR_2 ';' |
4341 | +# endif |
4342 | +#endif |
4343 | + |
4344 | +#ifndef DIR_SEPARATOR_2 |
4345 | +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
4346 | +#else /* DIR_SEPARATOR_2 */ |
4347 | +# define IS_DIR_SEPARATOR(ch) \ |
4348 | + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
4349 | +#endif /* DIR_SEPARATOR_2 */ |
4350 | + |
4351 | +#ifndef PATH_SEPARATOR_2 |
4352 | +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
4353 | +#else /* PATH_SEPARATOR_2 */ |
4354 | +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
4355 | +#endif /* PATH_SEPARATOR_2 */ |
4356 | + |
4357 | +#ifndef FOPEN_WB |
4358 | +# define FOPEN_WB "w" |
4359 | +#endif |
4360 | +#ifndef _O_BINARY |
4361 | +# define _O_BINARY 0 |
4362 | +#endif |
4363 | + |
4364 | +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
4365 | +#define XFREE(stale) do { \ |
4366 | + if (stale) { free ((void *) stale); stale = 0; } \ |
4367 | +} while (0) |
4368 | + |
4369 | +#if defined(LT_DEBUGWRAPPER) |
4370 | +static int lt_debug = 1; |
4371 | +#else |
4372 | +static int lt_debug = 0; |
4373 | +#endif |
4374 | + |
4375 | +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
4376 | + |
4377 | +void *xmalloc (size_t num); |
4378 | +char *xstrdup (const char *string); |
4379 | +const char *base_name (const char *name); |
4380 | +char *find_executable (const char *wrapper); |
4381 | +char *chase_symlinks (const char *pathspec); |
4382 | +int make_executable (const char *path); |
4383 | +int check_executable (const char *path); |
4384 | +char *strendzap (char *str, const char *pat); |
4385 | +void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
4386 | +void lt_fatal (const char *file, int line, const char *message, ...); |
4387 | +static const char *nonnull (const char *s); |
4388 | +static const char *nonempty (const char *s); |
4389 | +void lt_setenv (const char *name, const char *value); |
4390 | +char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
4391 | +void lt_update_exe_path (const char *name, const char *value); |
4392 | +void lt_update_lib_path (const char *name, const char *value); |
4393 | +char **prepare_spawn (char **argv); |
4394 | +void lt_dump_script (FILE *f); |
4395 | +EOF |
4396 | + |
4397 | + cat <<EOF |
4398 | +volatile const char * MAGIC_EXE = "$magic_exe"; |
4399 | +const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
4400 | +EOF |
4401 | + |
4402 | + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
4403 | + func_to_host_path "$temp_rpath" |
4404 | + cat <<EOF |
4405 | +const char * LIB_PATH_VALUE = "$func_to_host_path_result"; |
4406 | +EOF |
4407 | + else |
4408 | + cat <<"EOF" |
4409 | +const char * LIB_PATH_VALUE = ""; |
4410 | +EOF |
4411 | + fi |
4412 | + |
4413 | + if test -n "$dllsearchpath"; then |
4414 | + func_to_host_path "$dllsearchpath:" |
4415 | + cat <<EOF |
4416 | +const char * EXE_PATH_VARNAME = "PATH"; |
4417 | +const char * EXE_PATH_VALUE = "$func_to_host_path_result"; |
4418 | +EOF |
4419 | + else |
4420 | + cat <<"EOF" |
4421 | +const char * EXE_PATH_VARNAME = ""; |
4422 | +const char * EXE_PATH_VALUE = ""; |
4423 | +EOF |
4424 | + fi |
4425 | + |
4426 | + if test "$fast_install" = yes; then |
4427 | + cat <<EOF |
4428 | +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
4429 | +EOF |
4430 | + else |
4431 | + cat <<EOF |
4432 | +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
4433 | +EOF |
4434 | + fi |
4435 | + |
4436 | + |
4437 | + cat <<"EOF" |
4438 | + |
4439 | +#define LTWRAPPER_OPTION_PREFIX "--lt-" |
4440 | + |
4441 | +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
4442 | +static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
4443 | +static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
4444 | + |
4445 | +int |
4446 | +main (int argc, char *argv[]) |
4447 | +{ |
4448 | + char **newargz; |
4449 | + int newargc; |
4450 | + char *tmp_pathspec; |
4451 | + char *actual_cwrapper_path; |
4452 | + char *actual_cwrapper_name; |
4453 | + char *target_name; |
4454 | + char *lt_argv_zero; |
4455 | + intptr_t rval = 127; |
4456 | + |
4457 | + int i; |
4458 | + |
4459 | + program_name = (char *) xstrdup (base_name (argv[0])); |
4460 | + newargz = XMALLOC (char *, argc + 1); |
4461 | + |
4462 | + /* very simple arg parsing; don't want to rely on getopt |
4463 | + * also, copy all non cwrapper options to newargz, except |
4464 | + * argz[0], which is handled differently |
4465 | + */ |
4466 | + newargc=0; |
4467 | + for (i = 1; i < argc; i++) |
4468 | + { |
4469 | + if (strcmp (argv[i], dumpscript_opt) == 0) |
4470 | + { |
4471 | +EOF |
4472 | + case "$host" in |
4473 | + *mingw* | *cygwin* ) |
4474 | + # make stdout use "unix" line endings |
4475 | + echo " setmode(1,_O_BINARY);" |
4476 | + ;; |
4477 | + esac |
4478 | + |
4479 | + cat <<"EOF" |
4480 | + lt_dump_script (stdout); |
4481 | + return 0; |
4482 | + } |
4483 | + if (strcmp (argv[i], debug_opt) == 0) |
4484 | + { |
4485 | + lt_debug = 1; |
4486 | + continue; |
4487 | + } |
4488 | + if (strcmp (argv[i], ltwrapper_option_prefix) == 0) |
4489 | + { |
4490 | + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
4491 | + namespace, but it is not one of the ones we know about and |
4492 | + have already dealt with, above (inluding dump-script), then |
4493 | + report an error. Otherwise, targets might begin to believe |
4494 | + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
4495 | + namespace. The first time any user complains about this, we'll |
4496 | + need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
4497 | + or a configure.ac-settable value. |
4498 | + */ |
4499 | + lt_fatal (__FILE__, __LINE__, |
4500 | + "unrecognized %s option: '%s'", |
4501 | + ltwrapper_option_prefix, argv[i]); |
4502 | + } |
4503 | + /* otherwise ... */ |
4504 | + newargz[++newargc] = xstrdup (argv[i]); |
4505 | + } |
4506 | + newargz[++newargc] = NULL; |
4507 | + |
4508 | +EOF |
4509 | + cat <<EOF |
4510 | + /* The GNU banner must be the first non-error debug message */ |
4511 | + lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); |
4512 | +EOF |
4513 | + cat <<"EOF" |
4514 | + lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
4515 | + lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
4516 | + |
4517 | + tmp_pathspec = find_executable (argv[0]); |
4518 | + if (tmp_pathspec == NULL) |
4519 | + lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
4520 | + lt_debugprintf (__FILE__, __LINE__, |
4521 | + "(main) found exe (before symlink chase) at: %s\n", |
4522 | + tmp_pathspec); |
4523 | + |
4524 | + actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
4525 | + lt_debugprintf (__FILE__, __LINE__, |
4526 | + "(main) found exe (after symlink chase) at: %s\n", |
4527 | + actual_cwrapper_path); |
4528 | + XFREE (tmp_pathspec); |
4529 | + |
4530 | + actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
4531 | + strendzap (actual_cwrapper_path, actual_cwrapper_name); |
4532 | + |
4533 | + /* wrapper name transforms */ |
4534 | + strendzap (actual_cwrapper_name, ".exe"); |
4535 | + tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
4536 | + XFREE (actual_cwrapper_name); |
4537 | + actual_cwrapper_name = tmp_pathspec; |
4538 | + tmp_pathspec = 0; |
4539 | + |
4540 | + /* target_name transforms -- use actual target program name; might have lt- prefix */ |
4541 | + target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
4542 | + strendzap (target_name, ".exe"); |
4543 | + tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
4544 | + XFREE (target_name); |
4545 | + target_name = tmp_pathspec; |
4546 | + tmp_pathspec = 0; |
4547 | + |
4548 | + lt_debugprintf (__FILE__, __LINE__, |
4549 | + "(main) libtool target name: %s\n", |
4550 | + target_name); |
4551 | +EOF |
4552 | + |
4553 | + cat <<EOF |
4554 | + newargz[0] = |
4555 | + XMALLOC (char, (strlen (actual_cwrapper_path) + |
4556 | + strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
4557 | + strcpy (newargz[0], actual_cwrapper_path); |
4558 | + strcat (newargz[0], "$objdir"); |
4559 | + strcat (newargz[0], "/"); |
4560 | +EOF |
4561 | + |
4562 | + cat <<"EOF" |
4563 | + /* stop here, and copy so we don't have to do this twice */ |
4564 | + tmp_pathspec = xstrdup (newargz[0]); |
4565 | + |
4566 | + /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
4567 | + strcat (newargz[0], actual_cwrapper_name); |
4568 | + |
4569 | + /* DO want the lt- prefix here if it exists, so use target_name */ |
4570 | + lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
4571 | + XFREE (tmp_pathspec); |
4572 | + tmp_pathspec = NULL; |
4573 | +EOF |
4574 | + |
4575 | + case $host_os in |
4576 | + mingw*) |
4577 | + cat <<"EOF" |
4578 | + { |
4579 | + char* p; |
4580 | + while ((p = strchr (newargz[0], '\\')) != NULL) |
4581 | + { |
4582 | + *p = '/'; |
4583 | + } |
4584 | + while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
4585 | + { |
4586 | + *p = '/'; |
4587 | + } |
4588 | + } |
4589 | +EOF |
4590 | + ;; |
4591 | + esac |
4592 | + |
4593 | + cat <<"EOF" |
4594 | + XFREE (target_name); |
4595 | + XFREE (actual_cwrapper_path); |
4596 | + XFREE (actual_cwrapper_name); |
4597 | + |
4598 | + lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
4599 | + lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
4600 | + /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must |
4601 | + be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) |
4602 | + because on Windows, both *_VARNAMEs are PATH but uninstalled |
4603 | + libraries must come first. */ |
4604 | + lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
4605 | + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
4606 | + |
4607 | + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
4608 | + nonnull (lt_argv_zero)); |
4609 | + for (i = 0; i < newargc; i++) |
4610 | + { |
4611 | + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
4612 | + i, nonnull (newargz[i])); |
4613 | + } |
4614 | + |
4615 | +EOF |
4616 | + |
4617 | + case $host_os in |
4618 | + mingw*) |
4619 | + cat <<"EOF" |
4620 | + /* execv doesn't actually work on mingw as expected on unix */ |
4621 | + newargz = prepare_spawn (newargz); |
4622 | + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
4623 | + if (rval == -1) |
4624 | + { |
4625 | + /* failed to start process */ |
4626 | + lt_debugprintf (__FILE__, __LINE__, |
4627 | + "(main) failed to launch target \"%s\": %s\n", |
4628 | + lt_argv_zero, nonnull (strerror (errno))); |
4629 | + return 127; |
4630 | + } |
4631 | + return rval; |
4632 | +EOF |
4633 | + ;; |
4634 | + *) |
4635 | + cat <<"EOF" |
4636 | + execv (lt_argv_zero, newargz); |
4637 | + return rval; /* =127, but avoids unused variable warning */ |
4638 | +EOF |
4639 | + ;; |
4640 | + esac |
4641 | + |
4642 | + cat <<"EOF" |
4643 | +} |
4644 | + |
4645 | +void * |
4646 | +xmalloc (size_t num) |
4647 | +{ |
4648 | + void *p = (void *) malloc (num); |
4649 | + if (!p) |
4650 | + lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
4651 | + |
4652 | + return p; |
4653 | +} |
4654 | + |
4655 | +char * |
4656 | +xstrdup (const char *string) |
4657 | +{ |
4658 | + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
4659 | + string) : NULL; |
4660 | +} |
4661 | + |
4662 | +const char * |
4663 | +base_name (const char *name) |
4664 | +{ |
4665 | + const char *base; |
4666 | + |
4667 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
4668 | + /* Skip over the disk name in MSDOS pathnames. */ |
4669 | + if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
4670 | + name += 2; |
4671 | +#endif |
4672 | + |
4673 | + for (base = name; *name; name++) |
4674 | + if (IS_DIR_SEPARATOR (*name)) |
4675 | + base = name + 1; |
4676 | + return base; |
4677 | +} |
4678 | + |
4679 | +int |
4680 | +check_executable (const char *path) |
4681 | +{ |
4682 | + struct stat st; |
4683 | + |
4684 | + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
4685 | + nonempty (path)); |
4686 | + if ((!path) || (!*path)) |
4687 | + return 0; |
4688 | + |
4689 | + if ((stat (path, &st) >= 0) |
4690 | + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
4691 | + return 1; |
4692 | + else |
4693 | + return 0; |
4694 | +} |
4695 | + |
4696 | +int |
4697 | +make_executable (const char *path) |
4698 | +{ |
4699 | + int rval = 0; |
4700 | + struct stat st; |
4701 | + |
4702 | + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
4703 | + nonempty (path)); |
4704 | + if ((!path) || (!*path)) |
4705 | + return 0; |
4706 | + |
4707 | + if (stat (path, &st) >= 0) |
4708 | + { |
4709 | + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
4710 | + } |
4711 | + return rval; |
4712 | +} |
4713 | + |
4714 | +/* Searches for the full path of the wrapper. Returns |
4715 | + newly allocated full path name if found, NULL otherwise |
4716 | + Does not chase symlinks, even on platforms that support them. |
4717 | +*/ |
4718 | +char * |
4719 | +find_executable (const char *wrapper) |
4720 | +{ |
4721 | + int has_slash = 0; |
4722 | + const char *p; |
4723 | + const char *p_next; |
4724 | + /* static buffer for getcwd */ |
4725 | + char tmp[LT_PATHMAX + 1]; |
4726 | + int tmp_len; |
4727 | + char *concat_name; |
4728 | + |
4729 | + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
4730 | + nonempty (wrapper)); |
4731 | + |
4732 | + if ((wrapper == NULL) || (*wrapper == '\0')) |
4733 | + return NULL; |
4734 | + |
4735 | + /* Absolute path? */ |
4736 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
4737 | + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
4738 | + { |
4739 | + concat_name = xstrdup (wrapper); |
4740 | + if (check_executable (concat_name)) |
4741 | + return concat_name; |
4742 | + XFREE (concat_name); |
4743 | + } |
4744 | + else |
4745 | + { |
4746 | +#endif |
4747 | + if (IS_DIR_SEPARATOR (wrapper[0])) |
4748 | + { |
4749 | + concat_name = xstrdup (wrapper); |
4750 | + if (check_executable (concat_name)) |
4751 | + return concat_name; |
4752 | + XFREE (concat_name); |
4753 | + } |
4754 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
4755 | + } |
4756 | +#endif |
4757 | + |
4758 | + for (p = wrapper; *p; p++) |
4759 | + if (*p == '/') |
4760 | + { |
4761 | + has_slash = 1; |
4762 | + break; |
4763 | + } |
4764 | + if (!has_slash) |
4765 | + { |
4766 | + /* no slashes; search PATH */ |
4767 | + const char *path = getenv ("PATH"); |
4768 | + if (path != NULL) |
4769 | + { |
4770 | + for (p = path; *p; p = p_next) |
4771 | + { |
4772 | + const char *q; |
4773 | + size_t p_len; |
4774 | + for (q = p; *q; q++) |
4775 | + if (IS_PATH_SEPARATOR (*q)) |
4776 | + break; |
4777 | + p_len = q - p; |
4778 | + p_next = (*q == '\0' ? q : q + 1); |
4779 | + if (p_len == 0) |
4780 | + { |
4781 | + /* empty path: current directory */ |
4782 | + if (getcwd (tmp, LT_PATHMAX) == NULL) |
4783 | + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
4784 | + nonnull (strerror (errno))); |
4785 | + tmp_len = strlen (tmp); |
4786 | + concat_name = |
4787 | + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
4788 | + memcpy (concat_name, tmp, tmp_len); |
4789 | + concat_name[tmp_len] = '/'; |
4790 | + strcpy (concat_name + tmp_len + 1, wrapper); |
4791 | + } |
4792 | + else |
4793 | + { |
4794 | + concat_name = |
4795 | + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
4796 | + memcpy (concat_name, p, p_len); |
4797 | + concat_name[p_len] = '/'; |
4798 | + strcpy (concat_name + p_len + 1, wrapper); |
4799 | + } |
4800 | + if (check_executable (concat_name)) |
4801 | + return concat_name; |
4802 | + XFREE (concat_name); |
4803 | + } |
4804 | + } |
4805 | + /* not found in PATH; assume curdir */ |
4806 | + } |
4807 | + /* Relative path | not found in path: prepend cwd */ |
4808 | + if (getcwd (tmp, LT_PATHMAX) == NULL) |
4809 | + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
4810 | + nonnull (strerror (errno))); |
4811 | + tmp_len = strlen (tmp); |
4812 | + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
4813 | + memcpy (concat_name, tmp, tmp_len); |
4814 | + concat_name[tmp_len] = '/'; |
4815 | + strcpy (concat_name + tmp_len + 1, wrapper); |
4816 | + |
4817 | + if (check_executable (concat_name)) |
4818 | + return concat_name; |
4819 | + XFREE (concat_name); |
4820 | + return NULL; |
4821 | +} |
4822 | + |
4823 | +char * |
4824 | +chase_symlinks (const char *pathspec) |
4825 | +{ |
4826 | +#ifndef S_ISLNK |
4827 | + return xstrdup (pathspec); |
4828 | +#else |
4829 | + char buf[LT_PATHMAX]; |
4830 | + struct stat s; |
4831 | + char *tmp_pathspec = xstrdup (pathspec); |
4832 | + char *p; |
4833 | + int has_symlinks = 0; |
4834 | + while (strlen (tmp_pathspec) && !has_symlinks) |
4835 | + { |
4836 | + lt_debugprintf (__FILE__, __LINE__, |
4837 | + "checking path component for symlinks: %s\n", |
4838 | + tmp_pathspec); |
4839 | + if (lstat (tmp_pathspec, &s) == 0) |
4840 | + { |
4841 | + if (S_ISLNK (s.st_mode) != 0) |
4842 | + { |
4843 | + has_symlinks = 1; |
4844 | + break; |
4845 | + } |
4846 | + |
4847 | + /* search backwards for last DIR_SEPARATOR */ |
4848 | + p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
4849 | + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
4850 | + p--; |
4851 | + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
4852 | + { |
4853 | + /* no more DIR_SEPARATORS left */ |
4854 | + break; |
4855 | + } |
4856 | + *p = '\0'; |
4857 | + } |
4858 | + else |
4859 | + { |
4860 | + lt_fatal (__FILE__, __LINE__, |
4861 | + "error accessing file \"%s\": %s", |
4862 | + tmp_pathspec, nonnull (strerror (errno))); |
4863 | + } |
4864 | + } |
4865 | + XFREE (tmp_pathspec); |
4866 | + |
4867 | + if (!has_symlinks) |
4868 | + { |
4869 | + return xstrdup (pathspec); |
4870 | + } |
4871 | + |
4872 | + tmp_pathspec = realpath (pathspec, buf); |
4873 | + if (tmp_pathspec == 0) |
4874 | + { |
4875 | + lt_fatal (__FILE__, __LINE__, |
4876 | + "could not follow symlinks for %s", pathspec); |
4877 | + } |
4878 | + return xstrdup (tmp_pathspec); |
4879 | +#endif |
4880 | +} |
4881 | + |
4882 | +char * |
4883 | +strendzap (char *str, const char *pat) |
4884 | +{ |
4885 | + size_t len, patlen; |
4886 | + |
4887 | + assert (str != NULL); |
4888 | + assert (pat != NULL); |
4889 | + |
4890 | + len = strlen (str); |
4891 | + patlen = strlen (pat); |
4892 | + |
4893 | + if (patlen <= len) |
4894 | + { |
4895 | + str += len - patlen; |
4896 | + if (strcmp (str, pat) == 0) |
4897 | + *str = '\0'; |
4898 | + } |
4899 | + return str; |
4900 | +} |
4901 | + |
4902 | +void |
4903 | +lt_debugprintf (const char *file, int line, const char *fmt, ...) |
4904 | +{ |
4905 | + va_list args; |
4906 | + if (lt_debug) |
4907 | + { |
4908 | + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
4909 | + va_start (args, fmt); |
4910 | + (void) vfprintf (stderr, fmt, args); |
4911 | + va_end (args); |
4912 | + } |
4913 | +} |
4914 | + |
4915 | +static void |
4916 | +lt_error_core (int exit_status, const char *file, |
4917 | + int line, const char *mode, |
4918 | + const char *message, va_list ap) |
4919 | +{ |
4920 | + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
4921 | + vfprintf (stderr, message, ap); |
4922 | + fprintf (stderr, ".\n"); |
4923 | + |
4924 | + if (exit_status >= 0) |
4925 | + exit (exit_status); |
4926 | +} |
4927 | + |
4928 | +void |
4929 | +lt_fatal (const char *file, int line, const char *message, ...) |
4930 | +{ |
4931 | + va_list ap; |
4932 | + va_start (ap, message); |
4933 | + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
4934 | + va_end (ap); |
4935 | +} |
4936 | + |
4937 | +static const char * |
4938 | +nonnull (const char *s) |
4939 | +{ |
4940 | + return s ? s : "(null)"; |
4941 | +} |
4942 | + |
4943 | +static const char * |
4944 | +nonempty (const char *s) |
4945 | +{ |
4946 | + return (s && !*s) ? "(empty)" : nonnull (s); |
4947 | +} |
4948 | + |
4949 | +void |
4950 | +lt_setenv (const char *name, const char *value) |
4951 | +{ |
4952 | + lt_debugprintf (__FILE__, __LINE__, |
4953 | + "(lt_setenv) setting '%s' to '%s'\n", |
4954 | + nonnull (name), nonnull (value)); |
4955 | + { |
4956 | +#ifdef HAVE_SETENV |
4957 | + /* always make a copy, for consistency with !HAVE_SETENV */ |
4958 | + char *str = xstrdup (value); |
4959 | + setenv (name, str, 1); |
4960 | +#else |
4961 | + int len = strlen (name) + 1 + strlen (value) + 1; |
4962 | + char *str = XMALLOC (char, len); |
4963 | + sprintf (str, "%s=%s", name, value); |
4964 | + if (putenv (str) != EXIT_SUCCESS) |
4965 | + { |
4966 | + XFREE (str); |
4967 | + } |
4968 | +#endif |
4969 | + } |
4970 | +} |
4971 | + |
4972 | +char * |
4973 | +lt_extend_str (const char *orig_value, const char *add, int to_end) |
4974 | +{ |
4975 | + char *new_value; |
4976 | + if (orig_value && *orig_value) |
4977 | + { |
4978 | + int orig_value_len = strlen (orig_value); |
4979 | + int add_len = strlen (add); |
4980 | + new_value = XMALLOC (char, add_len + orig_value_len + 1); |
4981 | + if (to_end) |
4982 | + { |
4983 | + strcpy (new_value, orig_value); |
4984 | + strcpy (new_value + orig_value_len, add); |
4985 | + } |
4986 | + else |
4987 | + { |
4988 | + strcpy (new_value, add); |
4989 | + strcpy (new_value + add_len, orig_value); |
4990 | + } |
4991 | + } |
4992 | + else |
4993 | + { |
4994 | + new_value = xstrdup (add); |
4995 | + } |
4996 | + return new_value; |
4997 | +} |
4998 | + |
4999 | +void |
5000 | +lt_update_exe_path (const char *name, const char *value) |