Charles Wilson wrote:
Charles Wilson wrote:
Charles Wilson wrote:
I'll whip up a patch and post it to the newlib list.

So, I posted the following:
http://sourceware.org/ml/newlib/2007/msg00271.html

However, there's no telling how long it'll be before a new cygwin kernel is released that includes the patch, and besides, libtool ought to work on current and reasonably recent cygwin kernels. So, how should libtool address this issue in the interim? Always use libltdl's argz stuff on cygwin, until <further notice: version check on uname, etc etc>?

If so, how do we induce that

Here's my attempt:

[snip long description of ugly runtime test]
See
http://lists.gnu.org/archive/html/libtool-patches/2007-03/msg00030.html

After discussion with Bob F, I've reimplemented this fix without the actual runtime test. Instead, if $host_os is cygwin, and cygwin version is 1.5.24 or older, then force use of libltdl builtin argz. In all other cases (including cross), pre-existing detection rules apply.

This is because the test is just too ugly for words, not to mention brittle. Trying to tease out malloc issues outside of a dedicated malloc testsuite is just plain silly.

========

I'm still using the -export-symbols-regex ".*" fix for libmlib in tests/mdemo -- it's also included in this patch.

Still true.

TESTING:
I've tested this under the following conditions:

(1) broken cygwin kernel (1.5.24-2 used, but any older would do)
    --detects failure, builds successfully using libltdl's argz
    --resultant libraries also work after dropping in a
      fixed cygwin kernel.
(2) fixed cygwin kernel (official snapshot from 20070330)
    --detects success, builds successfully using system argz
    --resultant libraries coredump if you drop in a broken cygwin
      kernel after the fact.  This is expected: broken cygwin is
      "broken" precisely because its argz facility coredumps on
      argz_insert().
(3) fixed cygwin kernel, but with $lt_cv_sys_argz_works=no.
    --does not even try to run the test program, and successfully
      builds using libltdl's argz
    --resultant libraries works fine even after dropping in a
      broken cygwin kernel.

Re-ran all of these tests under the specified conditions. Same results as the original patch.

(4) linux (whose system argz is OK)
    --detects success, builds using system argz, works.
(5) linux, but with $lt_cv_sys_argz_works=no.
    --doesn't run the test, and builds using libltdl argz. works.
(6) mingw, which doesn't have any system argz facility at all
    --the test is not run
    --builds successfully with libltdl's argz

Did not run these tests. configury and sourcecode paths unchanged from original path so these should obviously still work. But I'll retest if desired.

New Changelog:

2007-03-17  Charles Wilson  <[EMAIL PROTECTED]>

        * libltdl/argz_.h: ensure error_t definition is obtained
        in same mechanism system argz.h would have.
        * libltdl/libltdl/lt__glibc.h: also detect if
        SYSTEM_ARGZ_IS_BROKEN when determining whether to re#def
        argz* functions.
        * libltdl/m4/argz.m4: add new test to check if $host's
        argz facilities are known bad.
        * tests/mdemo/Makefile.am: -export-symbols-regex fix for
        libmlib.

--
Chuck
Index: libltdl/argz_.h
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/argz_.h,v
retrieving revision 1.6
diff -u -r1.6 argz_.h
--- libltdl/argz_.h     4 Sep 2006 17:23:30 -0000       1.6
+++ libltdl/argz_.h     17 Mar 2007 06:09:46 -0000
@@ -32,6 +32,8 @@
 #define LT__ARGZ_H 1
 
 #include <stdlib.h>
+#define __need_error_t
+#include <errno.h>
 #include <sys/types.h>
 
 #if defined(LTDL)
Index: libltdl/libltdl/lt__glibc.h
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/libltdl/lt__glibc.h,v
retrieving revision 1.7
diff -u -r1.7 lt__glibc.h
--- libltdl/libltdl/lt__glibc.h 26 Oct 2006 20:39:04 -0000      1.7
+++ libltdl/libltdl/lt__glibc.h 17 Mar 2007 06:09:49 -0000
@@ -37,7 +37,7 @@
 #  include <config.h>
 #endif
 
-#if !defined(HAVE_ARGZ_H)
+#if !defined(HAVE_ARGZ_H) || defined(SYSTEM_ARGZ_IS_BROKEN)
 /* Redefine any glibc symbols we reimplement to import the
    implementations into our lt__ namespace so we don't ever
    clash with the system library if our clients use argz_*
Index: libltdl/m4/argz.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/argz.m4,v
retrieving revision 1.3
diff -u -r1.3 argz.m4
--- libltdl/m4/argz.m4  25 Mar 2006 11:05:02 -0000      1.3
+++ libltdl/m4/argz.m4  17 Mar 2007 06:09:50 -0000
@@ -27,6 +27,38 @@
 ARGZ_H=
 AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next \
        argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
+
+dnl if have system argz functions, allow forced use of 
+dnl libltdl-supplied implementation (and default to do so
+dnl on "known bad" systems). Could use a runtime check, but
+dnl (a) detecting malloc issues is notoriously unreliable
+dnl (b) only known system that declares argz functions,
+dnl     provides them, yet they are broken, is cygwin
+dnl     releases prior to 16-Mar-2007 (1.5.24 and earlier)
+dnl So, it's more straightforward simply to special case 
+dnl this for known bad systems.
+AS_IF([test -z "$ARGZ_H"],[dnl
+    AC_CACHE_CHECK(
+        [if argz actually works],
+        [lt_cv_sys_argz_works],[dnl
+        AS_CASE($host_os,dnl
+        [*cygwin*],[dnl
+            os_ver=$(uname -r | $SED -e 's,^\([[0123456789\.]]*\).*,\1,')
+            os_major=${os_ver%%\.*}
+            os_micro=${os_ver##*\.}
+            os_minor=${os_ver%\.*}
+            os_minor=${os_minor##*\.}
+            AS_IF([test "$os_major" -gt "1"],[lt_cv_sys_argz_works=yes],dnl
+                 [test "$os_minor" -gt "5"],[lt_cv_sys_argz_works=yes],dnl
+                 [test "$os_micro" -gt "24"],[lt_cv_sys_argz_works=yes],dnl
+                 [lt_cv_sys_argz_works=no])],dnl
+        [lt_cv_sys_argz_works=yes])])
+    AS_IF([test $lt_cv_sys_argz_works != yes],[dnl
+        AC_DEFINE([SYSTEM_ARGZ_IS_BROKEN], 1,
+                  [This value is set to 1 to indicate that the system argz 
facility does not work])
+        ARGZ_H=argz.h
+        AC_LIBOBJ([argz])])])
+
 AC_SUBST([ARGZ_H])
 ])
 
Index: tests/mdemo/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/mdemo/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- tests/mdemo/Makefile.am     26 Feb 2007 07:44:25 -0000      1.9
+++ tests/mdemo/Makefile.am     17 Mar 2007 06:09:50 -0000
@@ -44,7 +44,7 @@
 
 libmlib_la_SOURCES = mlib.c
 libmlib_la_LIBADD = @LIBLTDL@ "-dlopen" foo1.la "-dlopen" libfoo2.la
-libmlib_la_LDFLAGS = -no-undefined
+libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
 libmlib_la_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la
 
 noinst_HEADERS = foo.h

Reply via email to