win32 short name and IFS='~'

2003-03-30 Thread Naofumi Yasufuku
Hi,

libtool uses '~' as IFS in some commands (ex. $archive_expsym_cmds),
so that win32 short name which includes '~' (ex. c:/progra~1/foo/...)
causes a problem. For example, if we want to build DLL which is linked
with -Lc:/progra~1/foo/lib -lbar, DLL build command fails.

I think it can be solved by putting off the command list variable
expansion until its execution loop.

In current libtool,

  # expand command list variable

  eval cmds=\$archive_expsym_cmds\  # $deplibs is expanded here
  

  # then, execute each command

  save_ifs=$IFS; IFS='~'
  for cmd in $cmds; do
IFS=$save_ifs
$show $cmd
$run eval $cmd || exit $?
  done
  IFS=$save_ifs

If $deplibs includes -Lc:/progra~1/foo/lib, $cmd is sepalated at
-Lc:/progra, so that DLL build fails.

If command list variable expansion is put off until execution,

  # set command list to $cmds

  cmds=$archive_expsym_cmds
  

  # execute each command

  save_ifs=$IFS; IFS='~'
  for temp_cmd in $cmds; do
IFS=$save_ifs
eval cmd=\$temp_cmd\   # $deplibs is expanded here
$show $cmd
$run eval $cmd || exit $?
  done
  IFS=$save_ifs

Command list is separated by IFS='~', then -Lc:/progra~1/foo/lib is
expanded into $cmd, and DLL build works well.

It enables libtool to treat win32 short name without changing IFS
character which is currently used.

What do you think of it?

Regards,
--Naofumi


___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool


Re: win32 short name and IFS='~'

2003-03-30 Thread Naofumi Yasufuku
At Mon, 31 Mar 2003 00:10:10 +0200,
Guido Draheim wrote:
 
 I have a similar problem on a different account: the version
 management system at my employer uses ~ in directory names
 to flag different branches and subversions of projects and
 their checkout areas. The libtool has the tendency to
 resolve some symlinks, so it does not help to put some
 directories elsewhere. It was impossible to build with
 libtool in this environment - after some time I did write
 up an ac-macro that changes the _cmds IFS from ~ into ?
 which is much more uncommon to exist in either a filename
 or a _cmds specification. Add the following macro after
 OUTPUT, and you should be fine with any ~ in file or
 directory names in the system:
 
 http://ac-archive.sf.net/guidod/patch_libtool_changing_cmds_ifs.html
 
 Btw, I wouldn't mind if libtool would simply not use ~ as
 the IFS in its original source, so this libtool-patching
 could get obsolete once and for all. -- cheers, guido
 

I think '~' IFS char is chosen carefully and it shouldn't be changed.
For example, '?' might be used in regular expression, and so on.
In libtool, directories are mostly treated as absolute path, so that
'~' is relatively safe.

Regards,
--Naofumi


___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool


Re: win32 short name and IFS='~'

2003-03-31 Thread Naofumi Yasufuku
At Mon, 31 Mar 2003 05:52:47 +0900,
Naofumi Yasufuku wrote:
 
 Hi,
 
 libtool uses '~' as IFS in some commands (ex. $archive_expsym_cmds),
 so that win32 short name which includes '~' (ex. c:/progra~1/foo/...)
 causes a problem. For example, if we want to build DLL which is linked
 with -Lc:/progra~1/foo/lib -lbar, DLL build command fails.
 
 I think it can be solved by putting off the command list variable
 expansion until its execution loop.
 

This is the patch against the latest CVS HEAD.
I've tested it under Cygwin/MinGW on my WinXP box.

Could anyone test this patch?

Regards,
--Naofumi

tilde-ifs.patch:
---
Index: ltmain.in
===
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.330
diff -u -r1.330 ltmain.in
--- ltmain.in   29 Mar 2003 04:09:00 -  1.330
+++ ltmain.in   31 Mar 2003 12:56:19 -
@@ -2273,9 +2273,9 @@
else
  $show extracting exported symbol list from \`$soname'
  save_ifs=$IFS; IFS='~'
- eval cmds=\$extract_expsyms_cmds\
- for cmd in $cmds; do
+ for cmd in $extract_expsyms_cmds; do
IFS=$save_ifs
+   eval cmd=\$cmd\
$show $cmd
$run eval $cmd || exit $?
  done
@@ -2286,9 +2286,9 @@
if test -f $output_objdir/$newlib; then :; else
  $show generating import library for \`$soname'
  save_ifs=$IFS; IFS='~'
- eval cmds=\$old_archive_from_expsyms_cmds\
- for cmd in $cmds; do
+ for cmd in $old_archive_from_expsyms_cmds; do
IFS=$save_ifs
+   eval cmd=\$cmd\
$show $cmd
$run eval $cmd || exit $?
  done
@@ -3497,10 +3497,10 @@
$show generating symbol list for \`$libname.la'
export_symbols=$output_objdir/$libname.exp
$run $rm $export_symbols
-   eval cmds=\$export_symbols_cmds\
save_ifs=$IFS; IFS='~'
-   for cmd in $cmds; do
+   for cmd in $export_symbols_cmds; do
  IFS=$save_ifs
+ eval cmd=\$cmd\
  if len=`expr X$cmd : .*` 
   test $len -le $max_cmd_len || test $max_cmd_len -le -1; then
$show $cmd
@@ -3617,19 +3617,20 @@
# Do each of the archive commands.
if test $module = yes  test -n $module_cmds ; then
  if test -n $export_symbols  test -n $module_expsym_cmds; then
-   eval cmds=\$module_expsym_cmds\
+   cmds=$module_expsym_cmds
  else
-   eval cmds=\$module_cmds\
+   cmds=$module_cmds
  fi
else
-   if test -n $export_symbols  test -n $archive_expsym_cmds; then
- eval cmds=\$archive_expsym_cmds\
-   else
- eval cmds=\$archive_cmds\
+ if test -n $export_symbols  test -n $archive_expsym_cmds; then
+   cmds=$archive_expsym_cmds
+ else
+   cmds=$archive_cmds
  fi
fi
 
-   if test X$skipped_export != X:  len=`expr X$cmds : .*` 
+   eval cmds_eval=\$cmds\
+   if test X$skipped_export != X:  len=`expr X$cmds_eval : .*` 
   test $len -le $max_cmd_len || test $max_cmd_len -le -1; then
  :
else
@@ -3671,11 +3672,11 @@
  # command to the queue.
  if test $k -eq 1 ; then
# The first file doesn't have a previous command to add.
-   eval concat_cmds=\$reload_cmds $objlist $last_robj\
+   concat_cmds=\$reload_cmds \$objlist \$last_robj
  else
# All subsequent reloadable object files will link in
# the last one created.
-   eval concat_cmds=\\$concat_cmds~$reload_cmds $objlist $last_robj\
+   concat_cmds=${concat_cmds}~\$reload_cmds \$objlist \$last_robj
  fi
  last_robj=$output_objdir/$save_output-${k}.$objext
  k=`expr $k + 1`
@@ -3688,7 +3689,7 @@
  # reloadable object file.  All subsequent reloadable object
  # files will link in the last one created.
  test -z $concat_cmds || concat_cmds=$concat_cmds~
- eval concat_cmds=\\${concat_cmds}$reload_cmds $objlist $last_robj\
+ concat_cmds=${concat_cmds}\$reload_cmds \$objlist \$last_robj
 
  if ${skipped_export-false}; then
$show generating symbol list for \`$libname.la'
@@ -3696,7 +3697,7 @@
$run $rm $export_symbols
libobjs=$output
# Append the command to create the export file.
-   eval concat_cmds=\\$concat_cmds~$export_symbols_cmds\
+   concat_cmds=${concat_cmds}~\$export_symbols_cmds
   fi
 
  # Set up a command to remove the reloadale object files
@@ -3714,6 +3715,7 @@
  save_ifs=$IFS; IFS

Re: win32 short name and IFS='~'

2003-03-31 Thread Naofumi Yasufuku
At Mon, 31 Mar 2003 23:10:35 +0900,
Naofumi Yasufuku wrote:
 
 [1  text/plain; US-ASCII (7bit)]
 At Mon, 31 Mar 2003 05:52:47 +0900,
 Naofumi Yasufuku wrote:
  
  Hi,
  
  libtool uses '~' as IFS in some commands (ex. $archive_expsym_cmds),
  so that win32 short name which includes '~' (ex. c:/progra~1/foo/...)
  causes a problem. For example, if we want to build DLL which is linked
  with -Lc:/progra~1/foo/lib -lbar, DLL build command fails.
  
  I think it can be solved by putting off the command list variable
  expansion until its execution loop.
  
 
 This is the patch against the latest CVS HEAD.
 I've tested it under Cygwin/MinGW on my WinXP box.
 
 Could anyone test this patch?
 
 Regards,
 --Naofumi
 
 tilde-ifs.patch:
[snip]


Former tilde-ifs.patch has a problem with piecewise linking.

This is the fixed version of tilde-ifs.patch.
I've tested it under MinGW/Cygwin and Linux.

Regards,
--Naofumi


tilde-ifs-2.patch:
---
Index: ltmain.in
===
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.333
diff -u -r1.333 ltmain.in
--- ltmain.in   31 Mar 2003 17:36:00 -  1.333
+++ ltmain.in   1 Apr 2003 07:28:58 -
@@ -2279,9 +2279,9 @@
else
  $show extracting exported symbol list from \`$soname'
  save_ifs=$IFS; IFS='~'
- eval cmds=\$extract_expsyms_cmds\
- for cmd in $cmds; do
+ for cmd in $extract_expsyms_cmds; do
IFS=$save_ifs
+   eval cmd=\$cmd\
$show $cmd
$run eval $cmd || exit $?
  done
@@ -2292,9 +2292,9 @@
if test -f $output_objdir/$newlib; then :; else
  $show generating import library for \`$soname'
  save_ifs=$IFS; IFS='~'
- eval cmds=\$old_archive_from_expsyms_cmds\
- for cmd in $cmds; do
+ for cmd in $old_archive_from_expsyms_cmds; do
IFS=$save_ifs
+   eval cmd=\$cmd\
$show $cmd
$run eval $cmd || exit $?
  done
@@ -3541,10 +3541,10 @@
$show generating symbol list for \`$libname.la'
export_symbols=$output_objdir/$libname.exp
$run $rm $export_symbols
-   eval cmds=\$export_symbols_cmds\
save_ifs=$IFS; IFS='~'
-   for cmd in $cmds; do
+   for cmd in $export_symbols_cmds; do
  IFS=$save_ifs
+ eval cmd=\$cmd\
  if len=`expr X$cmd : .*` 
   test $len -le $max_cmd_len || test $max_cmd_len -le -1; then
$show $cmd
@@ -3661,19 +3661,20 @@
# Do each of the archive commands.
if test $module = yes  test -n $module_cmds ; then
  if test -n $export_symbols  test -n $module_expsym_cmds; then
-   eval cmds=\$module_expsym_cmds\
+   cmds=$module_expsym_cmds
  else
-   eval cmds=\$module_cmds\
+   cmds=$module_cmds
  fi
else
-   if test -n $export_symbols  test -n $archive_expsym_cmds; then
- eval cmds=\$archive_expsym_cmds\
-   else
- eval cmds=\$archive_cmds\
+ if test -n $export_symbols  test -n $archive_expsym_cmds; then
+   cmds=$archive_expsym_cmds
+ else
+   cmds=$archive_cmds
  fi
fi
 
-   if test X$skipped_export != X:  len=`expr X$cmds : .*` 
+   eval test_cmds=\$cmds\
+   if test X$skipped_export != X:  len=`expr X$test_cmds : .*` 
   test $len -le $max_cmd_len || test $max_cmd_len -le -1; then
  :
else
@@ -3695,8 +3696,7 @@
 
  # Clear the reloadable object creation command queue and
  # initialize k to one.
- test_cmds=
- concat_cmds=
+ temp_cmds=
  objlist=
  delfiles=
  last_robj=
@@ -3705,22 +3705,22 @@
  # Loop over the list of objects to be linked.
  for obj in $save_libobjs
  do
-   eval test_cmds=\$reload_cmds $objlist $last_robj\
+   eval temp_cmds=\$reload_cmds $objlist $last_robj\
if test X$objlist = X ||
-  { len=`expr X$test_cmds : .*` 
+  { len=`expr X$temp_cmds : .*` 
 test $len -le $max_cmd_len; }; then
  objlist=$objlist $obj
else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test $k -eq 1 ; then
-   # The first file doesn't have a previous command to add.
-   eval concat_cmds=\$reload_cmds $objlist $last_robj\
- else
-   # All subsequent reloadable object files will link in
-   # the last one created.
-   eval concat_cmds=\\$concat_cmds~$reload_cmds $objlist $last_robj\
- fi