Re: Revenge of the $ECHO. Kill most uses of Xsed.

2008-11-24 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Sun, Nov 16, 2008 at 11:48:01PM CET:
 There is at least one more place with problematic usage of $ECHO, in
 func_infer_tag (several instances in two lines).  Not yet sure how to
 fix that in a concise way.

Like this.  I also added some initial testsuite exposure.  This doesn't
really exercise the code paths changed by the ltmain part of the patch,
though.  Commit c76530e05 was done (on 2004-02-04) to match $CC that
contains a `~', the `$ECHO $CC` construction stems from 6fcbecee4 from
the multi-language-branch (2000-07-26).

I guess a better test could set up a compiler wrapper script that used
these constructions.

Meanwhile, I pushed this.

Cheers,
Ralf

Fix func_infer_tag $ECHO usage; some testsuite exposure.

* libltdl/config/ltmain.m4sh (func_infer_tag): Use func_echo_all
rather than $ECHO for possibly multiple arguments.
* tests/infer-tag.at (inferred tag, CXX inferred tag)
(F77 inferred tag, FC inferred tag, GCJ inferred tag): New file,
new tests.
* Makefile.am: Adjust.

diff --git a/Makefile.am b/Makefile.am
index a09ed3d..98feed4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -466,6 +466,7 @@ TESTSUITE_AT= tests/testsuite.at \
  tests/indirect_deps.at \
  tests/archive-in-archive.at \
  tests/execute-mode.at \
+ tests/infer-tag.at \
  tests/localization.at \
  tests/install.at \
  tests/destdir.at \
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 0fe3fc9..2769149 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -578,10 +578,13 @@ func_infer_tag ()
 func_quote_for_eval $arg
CC_quoted=$CC_quoted $func_quote_for_eval_result
   done
+  CC_expanded=`func_echo_all $CC`
+  CC_quoted_expanded=`func_echo_all $CC_quoted`
   case $@ in
   # Blanks in the command may have been stripped by the calling shell,
   # but not from the CC environment variable when configure was run.
-   $CC * | $CC * |  `$ECHO $CC` * | `$ECHO $CC` * |  $CC_quoted* 
| $CC_quoted * |  `$ECHO $CC_quoted` * | `$ECHO $CC_quoted` *) ;;
+   $CC * | $CC * |  $CC_expanded * | $CC_expanded * | \
+   $CC_quoted* | $CC_quoted * |  $CC_quoted_expanded * | 
$CC_quoted_expanded *) ;;
   # Blanks at the start of $base_compile will cause this to fail
   # if we don't check for them as well.
   *)
@@ -595,8 +598,11 @@ func_infer_tag ()
  func_quote_for_eval $arg
  CC_quoted=$CC_quoted $func_quote_for_eval_result
done
+   CC_expanded=`func_echo_all $CC`
+   CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@  in
-  $CC * | $CC * |  `$ECHO $CC` * | `$ECHO $CC` * |  
$CC_quoted* | $CC_quoted * |  `$ECHO $CC_quoted` * | `$ECHO $CC_quoted` 
*)
+$CC * | $CC * |  $CC_expanded * | $CC_expanded * | \
+$CC_quoted* | $CC_quoted * |  $CC_quoted_expanded * | 
$CC_quoted_expanded *)
  # The compiler in the base compile command matches
  # the one in the tagged configuration.
  # Assume this is the tagged configuration we want.
diff --git a/tests/infer-tag.at b/tests/infer-tag.at
new file mode 100644
index 000..ebc7581
--- /dev/null
+++ b/tests/infer-tag.at
@@ -0,0 +1,101 @@
+# infer-tag.at -- libtool without --tag -*- Autotest -*-
+#
+#   Copyright (C) 2008 Free Software Foundation, Inc.
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# Check that func_infer_tag works.
+
+# We add one test per tag, so that only those tests are skipped
+# for which the tags are disabled (otherwise we only ever test
+# on systems where all tags are enabled).
+
+AT_SETUP([inferred tag])
+AT_KEYWORDS([libtool])
+
+AT_DATA([a.c],
+[[int a (void) { return 0; }
+]])
+
+AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],
+[], [ignore], [ignore])
+
+AT_CLEANUP
+
+AT_SETUP([CXX inferred tag])
+LT_AT_TAG([CXX])
+AT_KEYWORDS([libtool])
+
+AT_DATA([a.cpp],
+[[int a (void) { return 0; }
+]])
+

Re: [PATCH] [cygwin|mingw] fix dlpreopen with --disable-static

2008-11-24 Thread Ralf Wildenhues
Hello Brian,

* Brian Dessent wrote on Thu, Nov 13, 2008 at 11:16:24PM CET:
 Ralf Wildenhues wrote:
 
  I'm actually not sure whether _GLOBAL__F[ID]_.* can appear on w32.
  Do you know?  They should happen with C++ code using constructors
  and destructors IIRC.
 
 Yes they do occur, although not matching that regexp.  For one, they
 will have two leading underscores before the G, as with all symbols
 compared to their linux counterparts (i.e. __USER_LABEL_PREFIX__ is _
 on Cygwin/MinGW.)  For another I would have expected the regexp to match
 [FID] not F[ID] as there seems to generally be only one character in
 that position, whose purpose is illuminated by this comment in
 gcc/tree.c:
[...]
 This implies that 'FI' is not valid, or at least not recognised by the
 demangler as significant.

Well, the bug report that prompted this addition:
http://lists.gnu.org/archive/html/libtool-patches/2008-01/msg00033.html
http://lists.gnu.org/archive/html/bug-libtool/2008-01/msg9.html
needed F[ID] rather than [FID].  GCC 4.0.0 is used there on AIX.

Did GCC change since then, or is this system-dependent?

Thanks,
Ralf




Re: [PATCH] [cygwin|mingw] fix dlpreopen with --disable-static

2008-11-24 Thread Brian Dessent
Ralf Wildenhues wrote:

 Did GCC change since then, or is this system-dependent?

Interesting.  I'd be curious to see if powerpc-ibm-aix5.3.0.0-c++filt
recognises the FI/FD encoding, and if so then it would be reasonable to
conclude that this is in fact system-dependent or otherwise an internal
implementation detail.  Nevertheless it seems to me like the regexp
ought accept but not require the leading F since the testcase of a
simple ctor results in a symbol _GLOBAL__I_.* on Linux as well.

Brian




Re: [PATCH] [cygwin|mingw] fix dlpreopen with --disable-static

2008-11-24 Thread Charles Wilson
Brian Dessent wrote:
 Ralf Wildenhues wrote:
 
 Did GCC change since then, or is this system-dependent?
 
 Interesting.  I'd be curious to see if powerpc-ibm-aix5.3.0.0-c++filt
 recognises the FI/FD encoding, and if so then it would be reasonable to
 conclude that this is in fact system-dependent or otherwise an internal
 implementation detail.  Nevertheless it seems to me like the regexp
 ought accept but not require the leading F since the testcase of a
 simple ctor results in a symbol _GLOBAL__I_.* on Linux as well.

My revised patch is still in-progress, but I've changed the libtool.m4
[cygwin|mingw] part to look like this;

--
Chuck
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 35d7d5c..d45013d 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -4089,6 +4089,7 @@ m4_require([_LT_TAG_COMPILER])dnl
 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 m4_if([$1], [CXX], [
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq  $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   case $host_os in
   aix[[4-9]]*)
 # If we're using GNU nm, then we don't want the -C option.
@@ -4103,13 +4104,13 @@ m4_if([$1], [CXX], [
 _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
   ;;
   cygwin* | mingw* | cegcc*)
-_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ 
]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq  $export_symbols'
+_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ 
]]/s/.* //'\'' | sort | uniq  $export_symbols'
+_LT_TAGVAR(exclude_expsyms, 
$1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
   ;;
   *)
 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq  $export_symbols'
   ;;
   esac
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ], [
   runpath_var=
   _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -4248,7 +4249,8 @@ _LT_EOF
   _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
   _LT_TAGVAR(always_export_symbols, $1)=no
   _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq  
$export_symbols'
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ 
]]/s/.* //'\'' | sort | uniq  $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, 
$1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
 
   if $LD --help 21 | $GREP 'auto-import'  /dev/null; then
 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs 
$compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base 
-Xlinker --out-implib -Xlinker $lib'