33
34
# Provide generalized library-building support services.
35
# --config show all configuration variables
36
# --debug enable verbose shell tracing
37
# -n, --dry-run display commands without modifying any files
38
# --features display basic configuration information and exit
39
# --mode=MODE use operation mode MODE
40
# --preserve-dup-deps don't remove duplicate dependency libraries
41
# --quiet, --silent don't print informational messages
42
# --tag=TAG use configuration variables from tag TAG
43
# -v, --verbose print informational messages (default)
44
# --version print version information
45
# -h, --help print short or long help message
36
# --config show all configuration variables
37
# --debug enable verbose shell tracing
38
# -n, --dry-run display commands without modifying any files
39
# --features display basic configuration information and exit
40
# --mode=MODE use operation mode MODE
41
# --preserve-dup-deps don't remove duplicate dependency libraries
42
# --quiet, --silent don't print informational messages
43
# --no-quiet, --no-silent
44
# print informational messages (default)
45
# --tag=TAG use configuration variables from tag TAG
46
# -v, --verbose print more informational messages than default
47
# --no-verbose don't print the extra informational messages
48
# --version print version information
49
# -h, --help, --help-all print short, long, or detailed help message
47
51
# MODE must be one of the following:
49
# clean remove files from the build directory
50
# compile compile a source file into a libtool object
51
# execute automatically set library path, then run a program
52
# finish complete the installation of libtool libraries
53
# install install libraries or executables
54
# link create a library or an executable
55
# uninstall remove libraries from an installed directory
53
# clean remove files from the build directory
54
# compile compile a source file into a libtool object
55
# execute automatically set library path, then run a program
56
# finish complete the installation of libtool libraries
57
# install install libraries or executables
58
# link create a library or an executable
59
# uninstall remove libraries from an installed directory
57
# MODE-ARGS vary depending on the MODE.
61
# MODE-ARGS vary depending on the MODE. When passed as first option,
62
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
58
63
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
60
65
# When reporting a bug, please describe a test case to reproduce it and
61
66
# include the following information:
66
# compiler flags: $LTCFLAGS
67
# linker: $LD (gnu? $with_gnu_ld)
68
# $progname: (GNU libtool) 2.2.6b
69
# automake: $automake_version
70
# autoconf: $autoconf_version
71
# compiler flags: $LTCFLAGS
72
# linker: $LD (gnu? $with_gnu_ld)
73
# $progname: (GNU libtool) 2.2.10
74
# automake: $automake_version
75
# autoconf: $autoconf_version
72
77
# Report bugs to <bug-libtool@gnu.org>.
78
package_revision=1.3017
83
package_revision=1.3175
80
85
# Be Bourne compatible
81
86
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
159
178
func_dirname_and_basename ()
161
180
# Extract subdirectory from the argument.
162
func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
181
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
163
182
if test "X$func_dirname_result" = "X${1}"; then
164
183
func_dirname_result="${3}"
166
185
func_dirname_result="$func_dirname_result${2}"
168
func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
187
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
171
190
# Generated shell functions inserted here.
173
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174
# is ksh but when the shell is invoked as "sh" and the current value of
175
# the _XPG environment variable is not equal to 1 (one), the special
176
# positional parameter $0, within a function call, is the name of the
192
# These SED scripts presuppose an absolute path with a trailing slash.
193
pathcar='s,^/\([^/]*\).*$,\1,'
194
pathcdr='s,^/[^/]*,,'
195
removedotparts=':dotsl
199
collapseslashes='s@/\{1,\}@/@g'
200
finalslash='s,/*$,/,'
202
# func_normal_abspath PATH
203
# Remove doubled-up and trailing slashes, "." path components,
204
# and cancel out any ".." path components in PATH after making
205
# it an absolute path.
206
# value returned in "$func_normal_abspath_result"
207
func_normal_abspath ()
209
# Start from root dir and reassemble the path.
210
func_normal_abspath_result=
211
func_normal_abspath_tpath=$1
212
func_normal_abspath_altnamespace=
213
case $func_normal_abspath_tpath in
215
# Empty path, that just means $cwd.
216
func_stripname '' '/' "`pwd`"
217
func_normal_abspath_result=$func_stripname_result
220
# The next three entries are used to spot a run of precisely
221
# two leading slashes without using negated character classes;
222
# we take advantage of case's first-match behaviour.
224
# Unusual form of absolute path, do nothing.
227
# Not necessarily an ordinary path; POSIX reserves leading '//'
228
# and for example Cygwin uses it to access remote file shares
229
# over CIFS/SMB, so we conserve a leading double slash if found.
230
func_normal_abspath_altnamespace=/
233
# Absolute path, do nothing.
236
# Relative path, prepend $cwd.
237
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
240
# Cancel out all the simple stuff to save iterations. We also want
241
# the path to end with a slash for ease of parsing, so make sure
242
# there is one (and only one) here.
243
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
244
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
246
# Processed it all yet?
247
if test "$func_normal_abspath_tpath" = / ; then
248
# If we ascended to the root using ".." the result may be empty now.
249
if test -z "$func_normal_abspath_result" ; then
250
func_normal_abspath_result=/
254
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
256
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
258
# Figure out what to do with it
259
case $func_normal_abspath_tcomponent in
261
# Trailing empty path component, ignore it.
264
# Parent dir; strip last assembled component from result.
265
func_dirname "$func_normal_abspath_result"
266
func_normal_abspath_result=$func_dirname_result
269
# Actual path component, append it.
270
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
274
# Restore leading double-slash if one was found on entry.
275
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
278
# func_relative_path SRCDIR DSTDIR
279
# generates a relative path from SRCDIR to DSTDIR, with a trailing
280
# slash if non-empty, suitable for immediately appending a filename
281
# without needing to append a separator.
282
# value returned in "$func_relative_path_result"
283
func_relative_path ()
285
func_relative_path_result=
286
func_normal_abspath "$1"
287
func_relative_path_tlibdir=$func_normal_abspath_result
288
func_normal_abspath "$2"
289
func_relative_path_tbindir=$func_normal_abspath_result
291
# Ascend the tree starting from libdir
293
# check if we have found a prefix of bindir
294
case $func_relative_path_tbindir in
295
$func_relative_path_tlibdir)
296
# found an exact match
297
func_relative_path_tcancelled=
300
$func_relative_path_tlibdir*)
301
# found a matching prefix
302
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
303
func_relative_path_tcancelled=$func_stripname_result
304
if test -z "$func_relative_path_result"; then
305
func_relative_path_result=.
310
func_dirname $func_relative_path_tlibdir
311
func_relative_path_tlibdir=${func_dirname_result}
312
if test "x$func_relative_path_tlibdir" = x ; then
313
# Have to descend all the way to the root!
314
func_relative_path_result=../$func_relative_path_result
315
func_relative_path_tcancelled=$func_relative_path_tbindir
318
func_relative_path_result=../$func_relative_path_result
323
# Now calculate path; take care to avoid doubling-up slashes.
324
func_stripname '' '/' "$func_relative_path_result"
325
func_relative_path_result=$func_stripname_result
326
func_stripname '/' '/' "$func_relative_path_tcancelled"
327
if test "x$func_stripname_result" != x ; then
328
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
331
# Normalisation. If bindir is libdir, return empty string,
332
# else relative path ending with a slash; either way, target
333
# file name can be directly appended.
334
if test ! -z "$func_relative_path_result"; then
335
func_stripname './' '' "$func_relative_path_result/"
336
func_relative_path_result=$func_stripname_result
180
340
# The name of this program:
181
# In the unlikely event $progname began with a '-', it would play havoc with
182
# func_echo (imagine progname=-n), so we prepend ./ in that case:
183
341
func_dirname_and_basename "$progpath"
184
342
progname=$func_basename_result
186
-*) progname=./$progname ;;
189
344
# Make sure we have an absolute path for reexecution:
190
345
case $progpath in
1825
2025
# Exit here if they wanted silent mode.
1826
2026
$opt_silent && exit $EXIT_SUCCESS
1828
$ECHO "X----------------------------------------------------------------------" | $Xsed
1829
$ECHO "Libraries have been installed in:"
2028
echo "----------------------------------------------------------------------"
2029
echo "Libraries have been installed in:"
1830
2030
for libdir in $libdirs; do
1831
2031
$ECHO " $libdir"
1834
$ECHO "If you ever happen to want to link against installed libraries"
1835
$ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1836
$ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1837
$ECHO "flag during linking and do at least one of the following:"
2034
echo "If you ever happen to want to link against installed libraries"
2035
echo "in a given directory, LIBDIR, you must either use libtool, and"
2036
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
2037
echo "flag during linking and do at least one of the following:"
1838
2038
if test -n "$shlibpath_var"; then
1839
$ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1840
$ECHO " during execution"
2039
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2040
echo " during execution"
1842
2042
if test -n "$runpath_var"; then
1843
$ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1844
$ECHO " during linking"
2043
echo " - add LIBDIR to the \`$runpath_var' environment variable"
2044
echo " during linking"
1846
2046
if test -n "$hardcode_libdir_flag_spec"; then
2717
2955
func_extract_an_archive "$my_xdir" "$my_xabs"
2720
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2958
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
2723
2961
func_extract_archives_result="$my_oldobjs"
2728
# func_emit_wrapper_part1 [arg=no]
2730
# Emit the first part of a libtool wrapper script on stdout.
2731
# For more information, see the description associated with
2732
# func_emit_wrapper(), below.
2733
func_emit_wrapper_part1 ()
2965
# func_emit_wrapper [arg=no]
2967
# Emit a libtool wrapper script on stdout.
2968
# Don't directly open a file because we may want to
2969
# incorporate the script contents within a cygwin/mingw
2970
# wrapper executable. Must ONLY be called from within
2971
# func_mode_link because it depends on a number of variables
2974
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2975
# variable will take. If 'yes', then the emitted script
2976
# will assume that the directory in which it is stored is
2977
# the $objdir directory. This is a cygwin/mingw-specific
2979
func_emit_wrapper ()
2735
func_emit_wrapper_part1_arg1=no
2736
if test -n "$1" ; then
2737
func_emit_wrapper_part1_arg1=$1
2981
func_emit_wrapper_arg1=${1-no}
2783
3025
# When we are sourced in execute mode, \$file and \$ECHO are already set.
2784
3026
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2787
# Make sure echo works.
2788
if test \"X\$1\" = X--no-reexec; then
2789
# Discard the --no-reexec flag, and continue.
2791
elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2792
# Yippee, \$ECHO works!
2795
# Restart under the correct shell, and then maybe \$ECHO will work.
2796
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3029
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
3032
# A function that is used when there is no print builtin or printf.
3033
func_fallback_echo ()
3035
eval 'cat <<_LTECHO_EOF
3042
# Very basic option parsing. These options are (a) specific to
3043
# the libtool wrapper, (b) are identical between the wrapper
3044
# /script/ and the wrapper /executable/ which is used only on
3045
# windows platforms, and (c) all begin with the string "--lt-"
3046
# (application programs are unlikely to have options which match
3049
# There are only two supported options: --lt-debug and
3050
# --lt-dump-script. There is, deliberately, no --lt-help.
3052
# The first argument to this parsing function should be the
3053
# script's $0 value, followed by "$@".
3055
func_parse_lt_options ()
3061
case \"\$lt_opt\" in
3062
--lt-debug) lt_option_debug=1 ;;
3064
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
3065
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
3066
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
3067
cat \"\$lt_dump_D/\$lt_dump_F\"
3071
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
3077
# Print the debug banner immediately:
3078
if test -n \"\$lt_option_debug\"; then
3079
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
3083
# Used when --lt-debug. Prints its arguments to stdout
3084
# (redirection is the responsibility of the caller)
3085
func_lt_dump_args ()
3090
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
3091
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
3095
# Core function for launching the target application
3096
func_exec_program_core ()
3100
# Backslashes separate directories on plain windows
3101
*-*-mingw | *-*-os2* | *-cegcc*)
3103
if test -n \"\$lt_option_debug\"; then
3104
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
3105
func_lt_dump_args \${1+\"\$@\"} 1>&2
3107
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3113
if test -n \"\$lt_option_debug\"; then
3114
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
3115
func_lt_dump_args \${1+\"\$@\"} 1>&2
3117
exec \"\$progdir/\$program\" \${1+\"\$@\"}
3122
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3126
# A function to encapsulate launching the target application
3127
# Strips options in the --lt-* namespace from \$@ and
3128
# launches target application with the remaining arguments.
3129
func_exec_program ()
3135
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
3139
func_exec_program_core \${1+\"\$@\"}
3143
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
2802
3145
# Find the directory that this script lives in.
2803
thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3146
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
2804
3147
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2806
3149
# Follow symbolic links until we get to the real thisdir.
2807
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3150
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
2808
3151
while test -n \"\$file\"; do
2809
destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3152
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
2811
3154
# If there was a directory component, then change thisdir.
2812
3155
if test \"x\$destdir\" != \"x\$file\"; then
2928
3254
if test \"\$libtool_execute_magic\" != \"$magic\"; then
2929
3255
# Run the actual program with our arguments.
2932
# Backslashes separate directories on plain windows
2933
*-*-mingw | *-*-os2* | *-cegcc*)
2935
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2941
exec \"\$progdir/\$program\" \${1+\"\$@\"}
2946
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
3256
func_exec_program \${1+\"\$@\"}
2950
3259
# The program doesn't exist.
2951
3260
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2952
3261
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2953
$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
3262
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2959
# end: func_emit_wrapper_part2
2962
# func_emit_wrapper [arg=no]
2964
# Emit a libtool wrapper script on stdout.
2965
# Don't directly open a file because we may want to
2966
# incorporate the script contents within a cygwin/mingw
2967
# wrapper executable. Must ONLY be called from within
2968
# func_mode_link because it depends on a number of variables
2971
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2972
# variable will take. If 'yes', then the emitted script
2973
# will assume that the directory in which it is stored is
2974
# the $objdir directory. This is a cygwin/mingw-specific
2976
func_emit_wrapper ()
2978
func_emit_wrapper_arg1=no
2979
if test -n "$1" ; then
2980
func_emit_wrapper_arg1=$1
2983
# split this up so that func_emit_cwrapperexe_src
2984
# can call each part independently.
2985
func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2986
func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2990
3270
# func_to_host_path arg
3082
3358
func_to_host_pathlist ()
3084
3360
func_to_host_pathlist_result="$1"
3085
if test -n "$1" ; then
3361
if test -n "$1"; then
3088
3364
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3089
3365
# Remove leading and trailing path separator characters from
3090
3366
# ARG. msys behavior is inconsistent here, cygpath turns them
3091
3367
# into '.;' and ';.', and winepath ignores them completely.
3092
func_to_host_pathlist_tmp2="$1"
3093
# Once set for this call, this variable should not be
3094
# reassigned. It is used in tha fallback case.
3095
func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3096
$SED -e 's|^:*||' -e 's|:*$||'`
3368
func_stripname : : "$1"
3369
func_to_host_pathlist_tmp1=$func_stripname_result
3098
3371
*mingw* ) # Actually, msys.
3099
3372
# Awkward: cmd appends spaces to result.
3100
lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3101
func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3102
$SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3103
func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3104
$SED -e "$lt_sed_naive_backslashify"`
3373
func_to_host_pathlist_result=`
3374
( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
3375
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
3107
func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3108
func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3378
func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
3109
3379
$SED -e "$lt_sed_naive_backslashify"`
3304
3583
int make_executable (const char *path);
3305
3584
int check_executable (const char *path);
3306
3585
char *strendzap (char *str, const char *pat);
3307
void lt_fatal (const char *message, ...);
3586
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
3587
void lt_fatal (const char *file, int line, const char *message, ...);
3588
static const char *nonnull (const char *s);
3589
static const char *nonempty (const char *s);
3308
3590
void lt_setenv (const char *name, const char *value);
3309
3591
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3310
void lt_opt_process_env_set (const char *arg);
3311
void lt_opt_process_env_prepend (const char *arg);
3312
void lt_opt_process_env_append (const char *arg);
3313
int lt_split_name_value (const char *arg, char** name, char** value);
3314
3592
void lt_update_exe_path (const char *name, const char *value);
3315
3593
void lt_update_lib_path (const char *name, const char *value);
3317
static const char *script_text_part1 =
3320
func_emit_wrapper_part1 yes |
3321
$SED -e 's/\([\\"]\)/\\\1/g' \
3322
-e 's/^/ "/' -e 's/$/\\n"/'
3326
static const char *script_text_part2 =
3328
func_emit_wrapper_part2 yes |
3329
$SED -e 's/\([\\"]\)/\\\1/g' \
3330
-e 's/^/ "/' -e 's/$/\\n"/'
3594
char **prepare_spawn (char **argv);
3595
void lt_dump_script (FILE *f);
3334
3599
const char * MAGIC_EXE = "$magic_exe";
3427
printf ("%s", script_text_part1);
3428
printf ("%s", script_text_part2);
3681
lt_dump_script (stdout);
3684
if (strcmp (argv[i], debug_opt) == 0)
3689
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
3691
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3692
namespace, but it is not one of the ones we know about and
3693
have already dealt with, above (inluding dump-script), then
3694
report an error. Otherwise, targets might begin to believe
3695
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3696
namespace. The first time any user complains about this, we'll
3697
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3698
or a configure.ac-settable value.
3700
lt_fatal (__FILE__, __LINE__,
3701
"unrecognized %s option: '%s'",
3702
ltwrapper_option_prefix, argv[i]);
3705
newargz[++newargc] = xstrdup (argv[i]);
3433
newargz = XMALLOC (char *, argc + 1);
3707
newargz[++newargc] = NULL;
3711
/* The GNU banner must be the first non-error debug message */
3712
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
3715
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
3716
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
3434
3718
tmp_pathspec = find_executable (argv[0]);
3435
3719
if (tmp_pathspec == NULL)
3436
lt_fatal ("Couldn't find %s", argv[0]);
3437
LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3720
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
3721
lt_debugprintf (__FILE__, __LINE__,
3722
"(main) found exe (before symlink chase) at: %s\n",
3440
3725
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3441
LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3442
actual_cwrapper_path));
3726
lt_debugprintf (__FILE__, __LINE__,
3727
"(main) found exe (after symlink chase) at: %s\n",
3728
actual_cwrapper_path);
3443
3729
XFREE (tmp_pathspec);
3445
actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3731
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
3446
3732
strendzap (actual_cwrapper_path, actual_cwrapper_name);
3448
3734
/* wrapper name transforms */
3514
3801
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3515
3802
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3518
for (i = 1; i < argc; i++)
3520
if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3522
if (argv[i][env_set_opt_len] == '=')
3524
const char *p = argv[i] + env_set_opt_len + 1;
3525
lt_opt_process_env_set (p);
3527
else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3529
lt_opt_process_env_set (argv[++i]); /* don't copy */
3532
lt_fatal ("%s missing required argument", env_set_opt);
3535
if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3537
if (argv[i][env_prepend_opt_len] == '=')
3539
const char *p = argv[i] + env_prepend_opt_len + 1;
3540
lt_opt_process_env_prepend (p);
3542
else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3544
lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3547
lt_fatal ("%s missing required argument", env_prepend_opt);
3550
if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3552
if (argv[i][env_append_opt_len] == '=')
3554
const char *p = argv[i] + env_append_opt_len + 1;
3555
lt_opt_process_env_append (p);
3557
else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3559
lt_opt_process_env_append (argv[++i]); /* don't copy */
3562
lt_fatal ("%s missing required argument", env_append_opt);
3565
if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3567
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3568
namespace, but it is not one of the ones we know about and
3569
have already dealt with, above (inluding dump-script), then
3570
report an error. Otherwise, targets might begin to believe
3571
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3572
namespace. The first time any user complains about this, we'll
3573
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3574
or a configure.ac-settable value.
3576
lt_fatal ("Unrecognized option in %s namespace: '%s'",
3577
ltwrapper_option_prefix, argv[i]);
3580
newargz[++newargc] = xstrdup (argv[i]);
3582
newargz[++newargc] = NULL;
3584
LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3804
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
3805
nonnull (lt_argv_zero));
3585
3806
for (i = 0; i < newargc; i++)
3587
LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3808
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
3809
i, nonnull (newargz[i]));
4100
lt_debugprintf (const char *file, int line, const char *fmt, ...)
4105
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
4106
va_start (args, fmt);
4107
(void) vfprintf (stderr, fmt, args);
3870
lt_error_core (int exit_status, const char *mode,
4113
lt_error_core (int exit_status, const char *file,
4114
int line, const char *mode,
3871
4115
const char *message, va_list ap)
3873
fprintf (stderr, "%s: %s: ", program_name, mode);
4117
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
3874
4118
vfprintf (stderr, message, ap);
3875
4119
fprintf (stderr, ".\n");
3882
lt_fatal (const char *message, ...)
4126
lt_fatal (const char *file, int line, const char *message, ...)
3885
4129
va_start (ap, message);
3886
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4130
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
4135
nonnull (const char *s)
4137
return s ? s : "(null)";
4141
nonempty (const char *s)
4143
return (s && !*s) ? "(empty)" : nonnull (s);
3891
4147
lt_setenv (const char *name, const char *value)
3893
LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3894
(name ? name : "<NULL>"),
3895
(value ? value : "<NULL>")));
4149
lt_debugprintf (__FILE__, __LINE__,
4150
"(lt_setenv) setting '%s' to '%s'\n",
4151
nonnull (name), nonnull (value));
3897
4153
#ifdef HAVE_SETENV
3898
4154
/* always make a copy, for consistency with !HAVE_SETENV */
3937
4193
return new_value;
3941
lt_split_name_value (const char *arg, char** name, char** value)
3948
p = strchr (arg, (int)'=');
3953
*value = xstrdup (++p);
3955
len = strlen (arg) - strlen (*value);
3956
*name = XMALLOC (char, len);
3957
strncpy (*name, arg, len-1);
3958
(*name)[len - 1] = '\0';
3964
lt_opt_process_env_set (const char *arg)
3969
if (lt_split_name_value (arg, &name, &value) != 0)
3973
lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3976
lt_setenv (name, value);
3982
lt_opt_process_env_prepend (const char *arg)
3986
char *new_value = NULL;
3988
if (lt_split_name_value (arg, &name, &value) != 0)
3992
lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3995
new_value = lt_extend_str (getenv (name), value, 0);
3996
lt_setenv (name, new_value);
4003
lt_opt_process_env_append (const char *arg)
4007
char *new_value = NULL;
4009
if (lt_split_name_value (arg, &name, &value) != 0)
4013
lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
4016
new_value = lt_extend_str (getenv (name), value, 1);
4017
lt_setenv (name, new_value);
4024
4197
lt_update_exe_path (const char *name, const char *value)
4026
LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4027
(name ? name : "<NULL>"),
4028
(value ? value : "<NULL>")));
4199
lt_debugprintf (__FILE__, __LINE__,
4200
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4201
nonnull (name), nonnull (value));
4030
4203
if (name && *name && value && *value)
4237
/* Prepares an argument vector before calling spawn().
4238
Note that spawn() does not by itself call the command interpreter
4239
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
4240
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
4242
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
4243
}) ? "cmd.exe" : "command.com").
4244
Instead it simply concatenates the arguments, separated by ' ', and calls
4245
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
4246
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
4248
- Space and tab are interpreted as delimiters. They are not treated as
4249
delimiters if they are surrounded by double quotes: "...".
4250
- Unescaped double quotes are removed from the input. Their only effect is
4251
that within double quotes, space and tab are treated like normal
4253
- Backslashes not followed by double quotes are not special.
4254
- But 2*n+1 backslashes followed by a double quote become
4255
n backslashes followed by a double quote (n >= 0):
4260
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4261
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
4263
prepare_spawn (char **argv)
4269
/* Count number of arguments. */
4270
for (argc = 0; argv[argc] != NULL; argc++)
4273
/* Allocate new argument vector. */
4274
new_argv = XMALLOC (char *, argc + 1);
4276
/* Put quoted arguments into the new argument vector. */
4277
for (i = 0; i < argc; i++)
4279
const char *string = argv[i];
4281
if (string[0] == '\0')
4282
new_argv[i] = xstrdup ("\"\"");
4283
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
4285
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
4287
unsigned int backslashes;
4289
char *quoted_string;
4296
for (s = string; *s != '\0'; s++)
4300
length += backslashes + 1;
4308
length += backslashes + 1;
4310
quoted_string = XMALLOC (char, length + 1);
4316
for (s = string; *s != '\0'; s++)
4322
for (j = backslashes + 1; j > 0; j--)
4334
for (j = backslashes; j > 0; j--)
4340
new_argv[i] = quoted_string;
4343
new_argv[i] = (char *) string;
4345
new_argv[argc] = NULL;
4354
void lt_dump_script (FILE* f)
4357
func_emit_wrapper yes |
4358
$SED -e 's/\([\\"]\)/\\\1/g' \
4359
-e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
4062
4365
# end: func_emit_cwrapperexe_src
4367
# func_win32_import_lib_p ARG
4368
# True if ARG is an import lib, as indicated by $file_magic_cmd
4369
func_win32_import_lib_p ()
4372
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
4064
4378
# func_mode_link arg...
4065
4379
func_mode_link ()
4788
5113
arg="$func_quote_for_eval_result"
4791
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4792
# -r[0-9][0-9]* specifies the processor on the SGI compiler
4793
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4794
# +DA*, +DD* enable 64-bit mode on the HP compiler
4795
# -q* pass through compiler args for the IBM compiler
4796
# -m*, -t[45]*, -txscale* pass through architecture-specific
4797
# compiler args for GCC
4798
# -F/path gives path to uninstalled frameworks, gcc on darwin
4799
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4800
# @file GCC response files
5116
# Flags to be passed through unchanged, with rationale:
5117
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
5118
# -r[0-9][0-9]* specify processor for the SGI compiler
5119
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
5120
# +DA*, +DD* enable 64-bit mode for the HP compiler
5121
# -q* compiler args for the IBM compiler
5122
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
5123
# -F/path path to uninstalled frameworks, gcc on darwin
5124
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
5125
# @file GCC response files
5126
# -tp=* Portland pgcc target processor selection
4801
5127
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4802
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
5128
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
4803
5129
func_quote_for_eval "$arg"
4804
5130
arg="$func_quote_for_eval_result"
4805
5131
func_append compile_command " $arg"
5877
6204
# Just print a warning and add the library to dependency_libs so
5878
6205
# that the program can be linked against the static library.
5880
6207
$ECHO "*** Warning: This system can not link to static lib archive $lib."
5881
$ECHO "*** I have the capability to make that library automatically link in when"
5882
$ECHO "*** you link to this library. But I can only do this if you have a"
5883
$ECHO "*** shared version of the library, which you do not appear to have."
6208
echo "*** I have the capability to make that library automatically link in when"
6209
echo "*** you link to this library. But I can only do this if you have a"
6210
echo "*** shared version of the library, which you do not appear to have."
5884
6211
if test "$module" = yes; then
5885
$ECHO "*** But as you try to build a module library, libtool will still create "
5886
$ECHO "*** a static module, that should work as long as the dlopening application"
5887
$ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
6212
echo "*** But as you try to build a module library, libtool will still create "
6213
echo "*** a static module, that should work as long as the dlopening application"
6214
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
5888
6215
if test -z "$global_symbol_pipe"; then
5890
$ECHO "*** However, this would only work if libtool was able to extract symbol"
5891
$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5892
$ECHO "*** not find such a program. So, this module is probably useless."
5893
$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6217
echo "*** However, this would only work if libtool was able to extract symbol"
6218
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6219
echo "*** not find such a program. So, this module is probably useless."
6220
echo "*** \`nm' from GNU binutils and a full rebuild may help."
5895
6222
if test "$build_old_libs" = no; then
5896
6223
build_libtool_libs=module
6655
6983
newdeplibs="$newdeplibs $i"
6657
6985
droppeddeps=yes
6659
6987
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
6660
$ECHO "*** I have the capability to make that library automatically link in when"
6661
$ECHO "*** you link to this library. But I can only do this if you have a"
6662
$ECHO "*** shared version of the library, which you do not appear to have"
6663
$ECHO "*** because a test_compile did reveal that the linker did not use this one"
6664
$ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6988
echo "*** I have the capability to make that library automatically link in when"
6989
echo "*** you link to this library. But I can only do this if you have a"
6990
echo "*** shared version of the library, which you do not appear to have"
6991
echo "*** because a test_compile did reveal that the linker did not use this one"
6992
echo "*** as a dynamic dependency that programs can get resolved with at runtime."
6668
6996
droppeddeps=yes
6670
6998
$ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6671
$ECHO "*** make it link in! You will probably need to install it or some"
6672
$ECHO "*** library that it depends on before this library will be fully"
6673
$ECHO "*** functional. Installing it before continuing would be even better."
6999
echo "*** make it link in! You will probably need to install it or some"
7000
echo "*** library that it depends on before this library will be fully"
7001
echo "*** functional. Installing it before continuing would be even better."
6809
7137
none | unknown | *)
6811
tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6812
-e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
7139
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
6813
7140
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6814
7141
for i in $predeps $postdeps ; do
6815
7142
# can't use Xsed below, because $i might contain '/'
6816
tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
7143
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
6819
if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6820
$GREP . >/dev/null; then
7146
case $tmp_deplibs in
6822
7149
if test "X$deplibs_check_method" = "Xnone"; then
6823
$ECHO "*** Warning: inter-library dependencies are not supported in this platform."
7150
echo "*** Warning: inter-library dependencies are not supported in this platform."
6825
$ECHO "*** Warning: inter-library dependencies are not known to be supported."
7152
echo "*** Warning: inter-library dependencies are not known to be supported."
6827
$ECHO "*** All declared inter-library dependencies are being dropped."
7154
echo "*** All declared inter-library dependencies are being dropped."
6828
7155
droppeddeps=yes
6832
7160
versuffix=$versuffix_save
6839
7167
*-*-rhapsody* | *-*-darwin1.[012])
6840
7168
# On Rhapsody replace the C library with the System framework
6841
newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7169
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
6845
7173
if test "$droppeddeps" = yes; then
6846
7174
if test "$module" = yes; then
6848
$ECHO "*** Warning: libtool could not satisfy all declared inter-library"
7176
echo "*** Warning: libtool could not satisfy all declared inter-library"
6849
7177
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6850
$ECHO "*** a static module, that should work as long as the dlopening"
6851
$ECHO "*** application is linked with the -dlopen flag."
7178
echo "*** a static module, that should work as long as the dlopening"
7179
echo "*** application is linked with the -dlopen flag."
6852
7180
if test -z "$global_symbol_pipe"; then
6854
$ECHO "*** However, this would only work if libtool was able to extract symbol"
6855
$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6856
$ECHO "*** not find such a program. So, this module is probably useless."
6857
$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
7182
echo "*** However, this would only work if libtool was able to extract symbol"
7183
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7184
echo "*** not find such a program. So, this module is probably useless."
7185
echo "*** \`nm' from GNU binutils and a full rebuild may help."
6859
7187
if test "$build_old_libs" = no; then
6860
7188
oldlibs="$output_objdir/$libname.$libext"
6864
7192
build_libtool_libs=no
6867
$ECHO "*** The inter-library dependencies that have been dropped here will be"
6868
$ECHO "*** automatically added whenever a program is linked with this library"
6869
$ECHO "*** or is declared to -dlopen it."
7195
echo "*** The inter-library dependencies that have been dropped here will be"
7196
echo "*** automatically added whenever a program is linked with this library"
7197
echo "*** or is declared to -dlopen it."
6871
7199
if test "$allow_undefined" = no; then
6873
$ECHO "*** Since this library must not contain undefined symbols,"
6874
$ECHO "*** because either the platform does not support them or"
6875
$ECHO "*** it was explicitly requested with -no-undefined,"
6876
$ECHO "*** libtool will only create a static version of it."
7201
echo "*** Since this library must not contain undefined symbols,"
7202
echo "*** because either the platform does not support them or"
7203
echo "*** it was explicitly requested with -no-undefined,"
7204
echo "*** libtool will only create a static version of it."
6877
7205
if test "$build_old_libs" = no; then
6878
7206
oldlibs="$output_objdir/$libname.$libext"
6879
7207
build_libtool_libs=module
8174
8495
# place dlname in correct position for cygwin
8496
# In fact, it would be nice if we could use this code for all target
8497
# systems that can't hard-code library paths into their executables
8498
# and that have no shared library path variable independent of PATH,
8499
# but it turns out we can't easily determine that from inspecting
8500
# libtool variables, so we have to hard-code the OSs to which it
8501
# applies here; at the moment, that means platforms that use the PE
8502
# object format with DLL files. See the long comment at the top of
8503
# tests/bindir.at for full details.
8175
8504
tdlname=$dlname
8176
8505
case $host,$output,$installed,$module,$dlname in
8177
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8506
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8507
# If a -bindir argument was supplied, place the dll there.
8508
if test "x$bindir" != x ;
8510
func_relative_path "$install_libdir" "$bindir"
8511
tdlname=$func_relative_path_result$dlname
8513
# Otherwise fall back on heuristic.
8514
tdlname=../bin/$dlname
8179
8518
$ECHO > $output "\
8180
8519
# $outputname - a libtool library file