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