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