mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-18 14:16:00 +08:00
* ltmain.m4sh (func_emit_libtool_wrapper_script):
Take an argument to specify value assigned to WRAPPER_SCRIPT_BELONGS_IN_OBJDIR in the emitted script. (func_emit_libtool_cwrapperexe_source) [file scope]: define permission flags S_IXGRP and S_IXOTH if not already defined. (func_emit_libtool_cwrapperexe_source) [LTWRAPPER_DEBUGPRINTF]: Use C89-compatible syntax to mimic variadic macros. Adjust all callers. (func_emit_libtool_cwrapperexe_source) [check_executable]: avoid embedded #ifdefs; use S_IXGRP and S_IXOTH unconditionally. (func_emit_libtool_cwrapperexe_source) [make_executable]: ditto. (func_emit_libtool_cwrapperexe_source): don't rewrite WRAPPER_SCRIPT_BELONGS_IN_OBJDIR posthoc; instead pass correct argument when calling func_emit_libtool_wrapper_script. (func_mode_link): pass correct argument when calling func_emit_libtool_wrapper_script.
This commit is contained in:
parent
d754211cdb
commit
6265ea0793
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
|||||||
|
2007-06-09 Charles Wilson <libtool@cwilson.fastmail.fm>
|
||||||
|
|
||||||
|
* ltmain.m4sh (func_emit_libtool_wrapper_script):
|
||||||
|
Take an argument to specify value assigned to
|
||||||
|
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR in the emitted
|
||||||
|
script.
|
||||||
|
(func_emit_libtool_cwrapperexe_source) [file scope]:
|
||||||
|
define permission flags S_IXGRP and S_IXOTH if not
|
||||||
|
already defined.
|
||||||
|
(func_emit_libtool_cwrapperexe_source) [LTWRAPPER_DEBUGPRINTF]:
|
||||||
|
Use C89-compatible syntax to mimic variadic macros.
|
||||||
|
Adjust all callers.
|
||||||
|
(func_emit_libtool_cwrapperexe_source) [check_executable]:
|
||||||
|
avoid embedded #ifdefs; use S_IXGRP and S_IXOTH
|
||||||
|
unconditionally.
|
||||||
|
(func_emit_libtool_cwrapperexe_source) [make_executable]:
|
||||||
|
ditto.
|
||||||
|
(func_emit_libtool_cwrapperexe_source): don't rewrite
|
||||||
|
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR posthoc; instead pass
|
||||||
|
correct argument when calling func_emit_libtool_wrapper_script.
|
||||||
|
(func_mode_link): pass correct argument when calling
|
||||||
|
func_emit_libtool_wrapper_script.
|
||||||
|
|
||||||
2007-06-07 Charles Wilson <libtool@cwilson.fastmail.fm>
|
2007-06-07 Charles Wilson <libtool@cwilson.fastmail.fm>
|
||||||
|
|
||||||
* ltmain.m4sh (func_emit_libtool_cwrapperexe_source):
|
* ltmain.m4sh (func_emit_libtool_cwrapperexe_source):
|
||||||
|
@ -2209,15 +2209,27 @@ func_mode_install ()
|
|||||||
test "$mode" = install && func_mode_install ${1+"$@"}
|
test "$mode" = install && func_mode_install ${1+"$@"}
|
||||||
|
|
||||||
|
|
||||||
# func_emit_libtool_wrapper_script
|
# func_emit_libtool_wrapper_script arg
|
||||||
|
#
|
||||||
# emit a libtool wrapper script on stdout
|
# emit a libtool wrapper script on stdout
|
||||||
# don't directly open a file because we may want to
|
# don't directly open a file because we may want to
|
||||||
# incorporate the script contents within a cygwin/mingw
|
# incorporate the script contents within a cygwin/mingw
|
||||||
# wrapper executable. Must ONLY be called from within
|
# wrapper executable. Must ONLY be called from within
|
||||||
# func_mode_link because it depends on a number of variable
|
# func_mode_link because it depends on a number of variable
|
||||||
# set therein.
|
# set therein.
|
||||||
|
#
|
||||||
|
# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
||||||
|
# variable will take. If 'yes', then the emitted script
|
||||||
|
# will assume that the directory in which it is stored is
|
||||||
|
# the '.lib' directory. This is a cygwin/mingw-specific
|
||||||
|
# behavior.
|
||||||
func_emit_libtool_wrapper_script ()
|
func_emit_libtool_wrapper_script ()
|
||||||
{
|
{
|
||||||
|
func_emit_libtool_wrapper_script_arg1=no
|
||||||
|
if test -n "$1" ; then
|
||||||
|
func_emit_libtool_wrapper_script_arg1=$1
|
||||||
|
fi
|
||||||
|
|
||||||
$ECHO "\
|
$ECHO "\
|
||||||
#! $SHELL
|
#! $SHELL
|
||||||
|
|
||||||
@ -2301,8 +2313,9 @@ else
|
|||||||
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
|
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
|
||||||
done
|
done
|
||||||
|
|
||||||
# cygwin/mingw cwrapper will rewrite this line:
|
# Usually 'no', except on cygwin/mingw when embedded into
|
||||||
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
|
# the cwrapper.
|
||||||
|
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_libtool_wrapper_script_arg1
|
||||||
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
||||||
# special case for '.'
|
# special case for '.'
|
||||||
if test \"\$thisdir\" = \".\"; then
|
if test \"\$thisdir\" = \".\"; then
|
||||||
@ -2463,6 +2476,13 @@ EOF
|
|||||||
# define LT_PATHMAX 1024
|
# define LT_PATHMAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef S_IXOTH
|
||||||
|
# define S_IXOTH 0
|
||||||
|
#endif
|
||||||
|
#ifndef S_IXGRP
|
||||||
|
# define S_IXGRP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DIR_SEPARATOR
|
#ifndef DIR_SEPARATOR
|
||||||
# define DIR_SEPARATOR '/'
|
# define DIR_SEPARATOR '/'
|
||||||
# define PATH_SEPARATOR ':'
|
# define PATH_SEPARATOR ':'
|
||||||
@ -2499,9 +2519,17 @@ EOF
|
|||||||
|
|
||||||
#undef LTWRAPPER_DEBUGPRINTF
|
#undef LTWRAPPER_DEBUGPRINTF
|
||||||
#if defined DEBUGWRAPPER
|
#if defined DEBUGWRAPPER
|
||||||
# define LTWRAPPER_DEBUGPRINTF(format, ...) fprintf(stderr, format, __VA_ARGS__)
|
# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
|
||||||
|
static void
|
||||||
|
ltwrapper_debugprintf (const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, fmt);
|
||||||
|
(void) vfprintf (stderr, fmt, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
# define LTWRAPPER_DEBUGPRINTF(format, ...)
|
# define LTWRAPPER_DEBUGPRINTF(args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *program_name = NULL;
|
const char *program_name = NULL;
|
||||||
@ -2519,9 +2547,8 @@ void lt_fatal (const char *message, ...);
|
|||||||
static const char *script_text =
|
static const char *script_text =
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
func_emit_libtool_wrapper_script |
|
func_emit_libtool_wrapper_script yes |
|
||||||
$SED -e 's/\([\\"]\)/\\\1/g' \
|
$SED -e 's/\([\\"]\)/\\\1/g' \
|
||||||
-e 's/\(WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\)=.*/\1=yes/' \
|
|
||||||
-e 's/^/ "/' -e 's/$/\\n"/'
|
-e 's/^/ "/' -e 's/$/\\n"/'
|
||||||
echo ";"
|
echo ";"
|
||||||
|
|
||||||
@ -2540,8 +2567,8 @@ main (int argc, char *argv[])
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
program_name = (char *) xstrdup (base_name (argv[0]));
|
program_name = (char *) xstrdup (base_name (argv[0]));
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) argv[0] : %s\n", argv[0]);
|
LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) program_name : %s\n", program_name);
|
LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
|
||||||
|
|
||||||
/* very simple arg parsing; don't want to rely on getopt */
|
/* very simple arg parsing; don't want to rely on getopt */
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
@ -2582,12 +2609,12 @@ EOF
|
|||||||
tmp_pathspec = find_executable (argv[0]);
|
tmp_pathspec = find_executable (argv[0]);
|
||||||
if (tmp_pathspec == NULL)
|
if (tmp_pathspec == NULL)
|
||||||
lt_fatal ("Couldn't find %s", argv[0]);
|
lt_fatal ("Couldn't find %s", argv[0]);
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) found exe (before symlink chase) at : %s\n",
|
LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
|
||||||
tmp_pathspec);
|
tmp_pathspec));
|
||||||
|
|
||||||
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) found exe (after symlink chase) at : %s\n",
|
LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
|
||||||
actual_cwrapper_path);
|
actual_cwrapper_path));
|
||||||
XFREE (tmp_pathspec);
|
XFREE (tmp_pathspec);
|
||||||
|
|
||||||
shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
|
shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
|
||||||
@ -2602,8 +2629,8 @@ EOF
|
|||||||
XFREE (shwrapper_name);
|
XFREE (shwrapper_name);
|
||||||
shwrapper_name = tmp_pathspec;
|
shwrapper_name = tmp_pathspec;
|
||||||
tmp_pathspec = 0;
|
tmp_pathspec = 0;
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) libtool shell wrapper name: %s\n",
|
LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
|
||||||
shwrapper_name);
|
shwrapper_name));
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@ -2653,7 +2680,7 @@ EOF
|
|||||||
|
|
||||||
for (i = 0; i < argc + 1; i++)
|
for (i = 0; i < argc + 1; i++)
|
||||||
{
|
{
|
||||||
LTWRAPPER_DEBUGPRINTF ("(main) newargz[%d] : %s\n", i, newargz[i]);
|
LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -2714,20 +2741,13 @@ check_executable (const char *path)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
LTWRAPPER_DEBUGPRINTF ("(check_executable) : %s\n",
|
LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
|
||||||
path ? (*path ? path : "EMPTY!") : "NULL!");
|
path ? (*path ? path : "EMPTY!") : "NULL!"));
|
||||||
if ((!path) || (!*path))
|
if ((!path) || (!*path))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((stat (path, &st) >= 0) && (
|
if ((stat (path, &st) >= 0)
|
||||||
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
|
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
||||||
#if defined (S_IXOTH)
|
|
||||||
((st.st_mode & S_IXOTH) == S_IXOTH) ||
|
|
||||||
#endif
|
|
||||||
#if defined (S_IXGRP)
|
|
||||||
((st.st_mode & S_IXGRP) == S_IXGRP) ||
|
|
||||||
#endif
|
|
||||||
((st.st_mode & S_IXUSR) == S_IXUSR)))
|
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -2739,24 +2759,14 @@ make_executable (const char *path)
|
|||||||
int rval = 0;
|
int rval = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
|
LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
|
||||||
int S_XFLAGS =
|
path ? (*path ? path : "EMPTY!") : "NULL!"));
|
||||||
#if defined (S_IXOTH)
|
|
||||||
S_IXOTH ||
|
|
||||||
#endif
|
|
||||||
#if defined (S_IXGRP)
|
|
||||||
S_IXGRP ||
|
|
||||||
#endif
|
|
||||||
S_IXUSR;
|
|
||||||
|
|
||||||
LTWRAPPER_DEBUGPRINTF ("(make_executable) : %s\n",
|
|
||||||
path ? (*path ? path : "EMPTY!") : "NULL!");
|
|
||||||
if ((!path) || (!*path))
|
if ((!path) || (!*path))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (stat (path, &st) >= 0)
|
if (stat (path, &st) >= 0)
|
||||||
{
|
{
|
||||||
rval = chmod (path, st.st_mode | S_XFLAGS);
|
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
@ -2776,8 +2786,8 @@ find_executable (const char *wrapper)
|
|||||||
int tmp_len;
|
int tmp_len;
|
||||||
char *concat_name;
|
char *concat_name;
|
||||||
|
|
||||||
LTWRAPPER_DEBUGPRINTF ("(find_executable) : %s\n",
|
LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
|
||||||
wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
|
wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
|
||||||
|
|
||||||
if ((wrapper == NULL) || (*wrapper == '\0'))
|
if ((wrapper == NULL) || (*wrapper == '\0'))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2882,8 +2892,8 @@ chase_symlinks (const char *pathspec)
|
|||||||
int has_symlinks = 0;
|
int has_symlinks = 0;
|
||||||
while (strlen (tmp_pathspec) && !has_symlinks)
|
while (strlen (tmp_pathspec) && !has_symlinks)
|
||||||
{
|
{
|
||||||
LTWRAPPER_DEBUGPRINTF ("checking path component for symlinks: %s\n",
|
LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
|
||||||
tmp_pathspec);
|
tmp_pathspec));
|
||||||
if (lstat (tmp_pathspec, &s) == 0)
|
if (lstat (tmp_pathspec, &s) == 0)
|
||||||
{
|
{
|
||||||
if (S_ISLNK (s.st_mode) != 0)
|
if (S_ISLNK (s.st_mode) != 0)
|
||||||
@ -6718,7 +6728,7 @@ EOF
|
|||||||
$RM $output
|
$RM $output
|
||||||
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
||||||
|
|
||||||
func_emit_libtool_wrapper_script > $output
|
func_emit_libtool_wrapper_script no > $output
|
||||||
chmod +x $output
|
chmod +x $output
|
||||||
}
|
}
|
||||||
exit $EXIT_SUCCESS
|
exit $EXIT_SUCCESS
|
||||||
|
Loading…
Reference in New Issue
Block a user