* Ralf Wildenhues wrote on Thu, Aug 11, 2005 at 10:01:24AM CEST:
> * Eric Blake wrote on Wed, Aug 10, 2005 at 06:37:46PM CEST:
> > > >
> > > > This is wrong for cygwin. For starters, cygwin does not auto-append
> > > > .exe when
> > > > sourcing a file, but correctly sources the filename as it was spelled.
> > > > (.exe
> > > > is auto-appended when exec()ing an executable, but sourcing is
> > > > different from
> > > > exec()ing.)
*snip*
> > > MinGW still works this way, right?
> >
> > Sorry, but I don't use mingw often enough to know. Someone else will
> > have to field this question.
I got my answer here:
http://sourceforge.net/mailarchive/forum.php?thread_id=7944791&forum_id=5119
So, to conclude: we can simplify. These are the patches I have applied
to the respective branches to fix this issue. Since my func_source
patch also happened to fix a number of under-quotations, I ported that
to branch-2-0 as well. Resulting patches are attached.
Thanks to Earnie Boyd and Eric Blake for their help!
Cheers,
Ralf
* config/ltmain.m4sh (func_source): New function.
(func_mode_execute, func_mode_install, func_mode_link): Use it.
Do not append a dot to a file name to source, it breaks on
cygwin managed mounts and is not necessary anywhere.
Reported by Eric Blake <[EMAIL PROTECTED]>.
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.83
diff -u -r1.83 ltmain.m4sh
--- config/ltmain.m4sh 12 Aug 2005 20:34:19 -0000 1.83
+++ config/ltmain.m4sh 12 Aug 2005 20:56:52 -0000
@@ -643,6 +643,22 @@
}
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
# Generated shell functions inserted here.
@@ -1502,12 +1518,7 @@
# Read the libtool library.
dlname=
library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
@@ -1564,11 +1575,7 @@
*)
# Do a test to see if this is really a libtool program.
if func_ltwrapper_p "$file"; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
@@ -1831,11 +1838,7 @@
library_names=
old_library=
relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
@@ -2007,18 +2010,7 @@
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
+ func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
@@ -2029,11 +2021,7 @@
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
fi
libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ###
testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
@@ -2043,18 +2031,7 @@
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
+ func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
@@ -2359,11 +2336,7 @@
non_pic_object=
# Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
+ func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
@@ -2868,11 +2841,7 @@
non_pic_object=
# Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
+ func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
@@ -3119,8 +3088,7 @@
# Ignore non-libtool-libs
dependency_libs=
case $lib in
- *[[\\/]]*.la) . $lib ;;
- *.la) . ./$lib ;;
+ *.la) func_source "$lib" ;;
esac
# Collect preopened libtool deplibs, except any this library
@@ -3200,10 +3168,7 @@
if func_lalib_p "$lib"; then
library_names=
old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
@@ -3390,10 +3355,7 @@
# Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
case $host in
*-*-darwin*)
* config/ltmain.m4sh (func_source): New function.
(func_mode_execute, func_mode_install, func_mode_link): Use it.
Do not append a dot to a file name to source, it breaks on
cygwin managed mounts and is not necessary anywhere.
Reported by Eric Blake <[EMAIL PROTECTED]>.
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.1.2.68
diff -u -r1.1.2.68 ltmain.m4sh
--- config/ltmain.m4sh 12 Aug 2005 20:08:03 -0000 1.1.2.68
+++ config/ltmain.m4sh 12 Aug 2005 20:57:10 -0000
@@ -585,6 +585,24 @@
fi
}
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+
# func_win32_libid arg
# return the library type of file 'arg'
#
@@ -1448,12 +1466,7 @@
# Read the libtool library.
dlname=
library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
@@ -1510,11 +1523,7 @@
*)
# Do a test to see if this is really a libtool program.
if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
@@ -1783,11 +1792,7 @@
library_names=
old_library=
relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
+ func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
@@ -1971,18 +1976,7 @@
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
+ func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
@@ -1993,11 +1987,7 @@
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
fi
libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ###
testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
@@ -2007,18 +1997,7 @@
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
+ func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
@@ -2324,11 +2303,7 @@
non_pic_object=
# Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
+ func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
@@ -2837,11 +2812,7 @@
non_pic_object=
# Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
+ func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
@@ -3101,8 +3072,7 @@
# Ignore non-libtool-libs
dependency_libs=
case $lib in
- *[[\\/]]*.la) . $lib ;;
- *.la) . ./$lib ;;
+ *.la) func_source "$lib" ;;
esac
# Collect preopened libtool deplibs, except any this library
@@ -3176,10 +3146,7 @@
$GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
library_names=
old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
@@ -3365,10 +3332,7 @@
# Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
case $host in
*-*-darwin*)
* ltmain.in (install mode) [ cygwin, mingw ]: Do not append a dot
to a file name to source it, it breaks on cygwin managed mounts
and is not necessary anywhere.
Reported by Eric Blake <[EMAIL PROTECTED]>.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.81
diff -u -r1.334.2.81 ltmain.in
--- ltmain.in 5 Aug 2005 07:53:43 -0000 1.334.2.81
+++ ltmain.in 12 Aug 2005 20:57:24 -0000
@@ -5742,17 +5742,15 @@
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
# Check the variables that should have been set.
@@ -5780,17 +5778,15 @@
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
outputname=