Re: 350-gary-maintain-private-libobj-namespace

2008-05-19 Thread Eric Blake
Eric Blake ebb9 at byu.net writes:

 | * libltdl/m4/ltdl.m4 (_LT_LIBSOURCES): Delete.
 | (LTDL_INIT): Ignore arguments to AC_LIBSOURCES during _LTDL_SETUP,
 | on the assumption that libtoolize correctly installed them.
 |
 |
 | Looks good to me.  Please apply.
 
 Applied.

Bah.  I had tested with libtool, but not with m4; had I done so, I would not 
have caused the problem of referring to the now undefined _LT_LIBSOURCES.  
Committing this as an obvious followup.

From d4aec62a7e0eae9bfd94ca2620e0771a85a77476 Mon Sep 17 00:00:00 2001
From: Eric Blake [EMAIL PROTECTED]
Date: Mon, 19 May 2008 08:18:33 -0600
Subject: [PATCH] Fix regression from two days ago.

* libltdl/m4/ltdl.m4 (_LT_LIBOBJ): Don't refer to deleted macro.

Signed-off-by: Eric Blake [EMAIL PROTECTED]
---
 ChangeLog  |5 +
 libltdl/m4/ltdl.m4 |1 -
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 853adbb..e60db3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-19  Eric Blake  [EMAIL PROTECTED]
+
+   Fix regression from two days ago.
+   * libltdl/m4/ltdl.m4 (_LT_LIBOBJ): Don't refer to deleted macro.
+
 2008-05-17  Eric Blake  [EMAIL PROTECTED]
 
Speed up bootstrap by improving lt_combine.
diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4
index cdb94e6..3908963 100644
--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4
@@ -212,7 +212,6 @@ m4_define([$0], [])
 # of into LIBOBJS.
 AC_DEFUN([_LT_LIBOBJ], [
   m4_pattern_allow([^_LT_LIBOBJS$])
-  AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
   _LT_LIBOBJS=$_LT_LIBOBJS $1.$ac_objext
 ])# _LT_LIBOBJS
 
-- 
1.5.5.1








Re: 350-gary-maintain-private-libobj-namespace

2008-05-17 Thread Eric Blake

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Gary V. Vaughan on 5/16/2008 11:07 AM:
| Subject: [PATCH] Kill _LT_LIBSOURCES; it wasn't checking anything useful.
|
| * libltdl/m4/ltdl.m4 (_LT_LIBSOURCES): Delete.
| (LTDL_INIT): Ignore arguments to AC_LIBSOURCES during _LTDL_SETUP,
| on the assumption that libtoolize correctly installed them.
|
|
| Looks good to me.  Please apply.

Applied.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgu/fMACgkQ84KuGfSFAYBU3gCfSGMemuE1ZPy22w5B5A1ayYZn
N4cAoLh4v89yTsAGovpnYKlLuzqHEe8z
=F+Kz
-END PGP SIGNATURE-




Re: 350-gary-maintain-private-libobj-namespace

2008-05-16 Thread Gary V. Vaughan

Hi Eric,

On 13 May 2008, at 18:47, Eric Blake wrote:

So how about this patch?

From 5160f84d0c1d00883b0db3336d79863286e8e89a Mon Sep 17 00:00:00 2001
From: Eric Blake [EMAIL PROTECTED]
Date: Tue, 13 May 2008 16:45:29 -0600
Subject: [PATCH] Kill _LT_LIBSOURCES; it wasn't checking anything  
useful.


* libltdl/m4/ltdl.m4 (_LT_LIBSOURCES): Delete.
(LTDL_INIT): Ignore arguments to AC_LIBSOURCES during _LTDL_SETUP,
on the assumption that libtoolize correctly installed them.



Looks good to me.  Please apply.

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_






PGP.sig
Description: This is a digitally signed message part


Re: 350-gary-maintain-private-libobj-namespace

2008-05-13 Thread Eric Blake
Gary V. Vaughan gary at gnu.org writes:

   +
   +# Like AC_LIBSOURCES, except the directory where the source file is
   +# expected is separated from the user LIBOBJ directory.
   +AC_DEFUN([_LT_LIBSOURCES], [
   +  m4_foreach([_LTNAME], [$1], [
   +m4_syscmd([test -r libltdl/]_LTNAME[ || test ! -d libltdl/])dnl
   +m4_if(m4_sysval, [0], [],
   +  [AC_FATAL([missing libltdl/]_LTNAME)])
   +  ])
   +])
  [...]
 
  Changing a m4 file seems very brittle to me.  These files like to get
  installed into /usr/share/aclocal, where aclocal can find them even if
  you don't want to (and thus if you forget to -I ltdl/m4, you're  
  screwed).
  Isn't the real name of the libltdl subdirectory name known at autoconf
  time anyway?  (This is an honest, not a rhetorical question; I haven't
  checked.)
 
 I had thought that it was only available at autoconf time, and since the
 ltdl mode is selected at configure time and affects things too went with
 the solution I posted earlier.  Evidently, lack of caffeine was clouding
 my brain, and the solution is *much* easier now that I've noticed ltdl
 mode is selected at libtoolize time, and of course everything we need to
 know at configure time is available easily.
 
 Now that there is no need to keep a separate ltdl-libobjs.m4 file for
 the substitution stage, a much simplified version of the patch follows
 below, and is what I'll be committing in 60 hours or fewer 


| Unfortunately, the autoconf implementation of AC_LIBOBJ and
| friends requires all libobjs to be in the same directory, as
| declared by AC_CONFIG_LIBOBJ_DIR.  That might prevent using
| either recursive or nonrecursive libltdl if the parent project
| has libobjs of its own, except that this patch tracks libltdl's
| libobjs in another namespace:
|
| * libltdl/m4/ltdl.m4 (_LT_LIBOBJ, _LT_LIBSOURCES): Versions of
| AC_LIBOBJ and AC_LIBSOURCES that save missing sources in a
| ltdl_LIBOBJS automake macro, instead of the global LIBOBJS
| automake macro.  Content of the macros inspired by code from
| gnulib-tool.
|   +# _LT_LIBSOURCES(MODULE_NAMES)
|   +# 
|   +# Like AC_LIBSOURCES, except the directory where the libltdl  
source files
|   +# are expected is distinct from the user LIBOBJ directory.
|   +AC_DEFUN([_LT_LIBSOURCES], [
|   +  m4_foreach([_LTNAME], [$1], [
|   +m4_syscmd([test -r $lt_libobj_prefix]_LTNAME[ ||
|   + test -z $lt_libobj_prefix ||
|   + test ! -d $lt_libobj_prefix])dnl
|   +m4_if(m4_sysval, [0], [],
|   +  [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)])
|   +  ])
|   +])# _LT_LIBSOURCES

While trying to speed up autoconf on gnulib output, I noticed that this is flat 
out broken, and does absolutely nothing at detecting whether the required files 
are missing.  Consider:

$ autoconf --trace m4_syscmd
configure.ac:83:m4_syscmd:test -r $lt_libobj_prefixargz.c || test -
z $lt_libobj_prefix || test ! -d $lt_libobj_prefix
configure.ac:83:m4_syscmd:test -r $lt_libobj_prefixargz.c || test -
z $lt_libobj_prefix || test ! -d $lt_libobj_prefix
configure.ac:83:m4_syscmd:test -r $lt_libobj_prefixlt__dirent.c || test -
z $lt_libobj_prefix || test ! -d $lt_libobj_prefix
configure.ac:83:m4_syscmd:test -r $lt_libobj_prefixlt__strl.c || test -
z $lt_libobj_prefix || test ! -d $lt_libobj_prefix
...

Oops - there is no slash between $lt_libobj_prefix and argz.c.  Even worse, 
lt_libobj_prefix is undefined in the context of the m4_syscmd (remember, this 
is shell code that runs during autoconf, and not during configure), so the test 
ALWAYS succeeds at test -z $lt_libobj_prefix.  This also forks once per test, 
and tests argc.c twice, resulting in multiple needless forks and 
slower 'autoconf' time on cygwin.

Gnulib was able to get away with an autoconf-time check because it _generates_ 
the .m4 file that contains the replacement *_LIBSOURCES definition, and 
substitutes the correct directory name in during that generation.  And with my 
proposed patch to gnulib-tool, the autoconf-time test is run only once on a 
list of files, rather than one syscmd per file.  We need to rework this patch, 
or else fall back to configure-time checking instead of autoconf-time checking.

-- 
Eric Blake







Re: 350-gary-maintain-private-libobj-namespace

2008-05-13 Thread Eric Blake
Eric Blake ebb9 at byu.net writes:

 
 Gnulib was able to get away with an autoconf-time check because it 
_generates_ 
 the .m4 file that contains the replacement *_LIBSOURCES definition, and 
 substitutes the correct directory name in during that generation.  And with 
my 
 proposed patch to gnulib-tool, the autoconf-time test is run only once on a 
 list of files, rather than one syscmd per file.  We need to rework this 
patch, 
 or else fall back to configure-time checking instead of autoconf-time 
checking.
 

After thinking about this more: I like the concept of checking early (autoconf) 
rather than late (configure), when the check is necessary.  And I think it is 
technically possible - the user must run libtoolize to copy the various ltdl 
*.c files into location in the first place; so that same libtoolize invocation 
should also create a generated .m4 file that defines the replacement 
_LIBSOURCES macro, such that at autoconf time, the macro contains the hard-
coded location of the *.c files relative to the directory where libtoolize was 
run (and where configure.ac lives).

On the other hand, I'm not sure the check buys us anything.  In gnulib's case, 
I added the check into gnulib-tool because we once made the mistake of calling
AC_REPLACE_FUNC([__fpending]) while providing fpending.c instead of 
__fpending.c.  Additionally, the gnulib bug wasn't caught until the broken 
fpending module was used in another project, since gnulib itself doesn't really 
undergo a release process.  But libtool isn't as modular as gnulib, is less 
likely to be adding new AC_REPLACE_FUNC calls any time soon, and has its own 
testsuite that we run prior to any release (unlike gnulib), so we can probably 
skip the check altogether without any big loss in bug-catching ability.  It 
should be easy enough to prove that libtoolize always copies the correct *.c 
files into place, rather than penalizing every client package's autoconf with 
checks that libtoolize did its job.

So how about this patch?

From 5160f84d0c1d00883b0db3336d79863286e8e89a Mon Sep 17 00:00:00 2001
From: Eric Blake [EMAIL PROTECTED]
Date: Tue, 13 May 2008 16:45:29 -0600
Subject: [PATCH] Kill _LT_LIBSOURCES; it wasn't checking anything useful.

* libltdl/m4/ltdl.m4 (_LT_LIBSOURCES): Delete.
(LTDL_INIT): Ignore arguments to AC_LIBSOURCES during _LTDL_SETUP,
on the assumption that libtoolize correctly installed them.

Signed-off-by: Eric Blake [EMAIL PROTECTED]
---
 ChangeLog  |7 +++
 libltdl/m4/ltdl.m4 |   19 ++-
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 81f532e..685d826 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-13  Eric Blake  [EMAIL PROTECTED]
+
+   Kill _LT_LIBSOURCES; it wasn't checking anything useful.
+   * libltdl/m4/ltdl.m4 (_LT_LIBSOURCES): Delete.
+   (LTDL_INIT): Ignore arguments to AC_LIBSOURCES during _LTDL_SETUP,
+   on the assumption that libtoolize correctly installed them.
+
 2008-05-11  Charles Wilson  [EMAIL PROTECTED]
 
Ensure cwrapper compiles without warnings under -std=c99.
diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4
index 6c277b4..f3f5c7b 100644
--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4
@@ -217,21 +217,6 @@ AC_DEFUN([_LT_LIBOBJ], [
 ])# _LT_LIBOBJS
 
 
-# _LT_LIBSOURCES(MODULE_NAMES)
-# 
-# Like AC_LIBSOURCES, except the directory where the libltdl source files
-# are expected is distinct from the user LIBOBJ directory.
-AC_DEFUN([_LT_LIBSOURCES], [
-  m4_foreach([_LTNAME], [$1], [
-m4_syscmd([test -r $lt_libobj_prefix]_LTNAME[ ||
-   test -z $lt_libobj_prefix ||
-   test ! -d $lt_libobj_prefix])dnl
-m4_if(m4_sysval, [0], [],
-  [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)])
-  ])
-])# _LT_LIBSOURCES
-
-
 # LTDL_INIT([OPTIONS])
 # 
 # Clients of libltdl can use this macro to allow the installer to
@@ -245,9 +230,9 @@ _LT_SET_OPTIONS([$0], [$1])
 
 dnl We need to keep our own list of libobjs separate from our parent project,
 dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
-dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4.
+dnl we look for our own LIBOBJs.
 m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
-m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES]))
+m4_pushdef([AC_LIBSOURCES])
 
 dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
 m4_if(_LTDL_MODE, [],
-- 
1.5.5.1







Re: 350-gary-maintain-private-libobj-namespace

2008-01-30 Thread Gary V. Vaughan

Hallo Ralf (and other potential reviewers!)

On 30 Jan 2008, at 22:00, Gary V. Vaughan wrote:

Maybe Mail.app will co-operate if I use a '.txt' extension for the
patch attachments?  Let me know if this is better.  If not, I'll
post with mailnotify, and put up with the broken message threading.



Here is 349 again, attached as a txt file incase that helps any...

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_

from  Gary V. Vaughan  [EMAIL PROTECTED]

There are 5 distinct batches of files that libtoolize might
install into a project, depending on whether libltdl is
being installed in subproject mode, and in that case whether
the parent project shares the config and macro directories
with the subproject ltdl.  Make a separate function for each
of those 5 batches (4 new functions below, plus the recently
factored func_install_pkgltdl_files), and make a clearer
distinction between when each of them is needed:

* libtoolize.m4sh (func_install_pkgmacro_subproject):
New function for installing and reporting on m4 files copied
to a subproject ltdl directory.
(func_install_pkgmacro_parent): Similar new function for m4
files copied solely for the use of the parent project,
including serial checking.
(func_install_pkgconfig_subproject): New function for
installing and reporting on config helper files copied to a
subproject ltdl directory.
(func_install_pkgconfig_parent): Similar new function for
config helper files copied solely for the use of the parent
project, including serial checking.
(func_install_pkgmacro_files, func_install_pkgconfig_files):
Rewritten in terms of the above functions.
* tests/libtoolize.at: Adjust test expout's to match newly
regularized libtoolize output.
Move parent project pkgconfig files to build-aux directory
so that progress messages show an obvious difference to
pkgconfig files installed to subproject `config' directory.
(nonrecursive ltdl with AC_CONFIG_MACRO_DIR): New test.
(diagnose missing LT_CONFIG_LTDL_DIR): New test.
(subproject ltdl with non-shared directories): New test.
Reported by Eric Blake [EMAIL PROTECTED]

Index: b/libtoolize.m4sh
===
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -937,6 +937,100 @@ func_massage_aclocal_DATA ()
 }
 
 
+# func_install_pkgmacro_subproject
+# Unless --quiet was passed, display a message. Then copy pkgmacro_files
+# from libtool installation tree to subproject libltdl tree.
+func_install_pkgmacro_subproject ()
+{
+$opt_debug
+
+# Copy all the files from installed libltdl to this project, if the
+# user specified a macrodir.
+$opt_quiet || if test x$macrodir != x$subproject_macrodir; then
+  func_echo putting macros in \`$subproject_macrodir'.
+elif test -n $subproject_macrodir; then
+  func_echo putting macros in AC_CONFIG_MACRO_DIR, 
\`$subproject_macrodir'.
+fi
+
+func_copy_some_files argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files \
+  $aclocaldir $subproject_macrodir
+}
+
+
+# func_install_pkgmacro_parent
+# Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display
+# a message.  Then update appropriate macros if newer ones are available
+# from the libtool installation tree.
+func_install_pkgmacro_parent ()
+{
+$opt_debug
+
+# Copy all the files from installed libltdl to this project, if the
+# user specified a macrodir.
+$opt_quiet || if test -n $ac_macrodir; then
+  func_echo putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'.
+elif test -n $macrodir; then
+  func_echo putting macros in \`$macrodir'.
+fi
+
+if $opt_ltdl; then
+  func_serial_update argz.m4 $aclocaldir $macrodir argz.m4
+else
+  func_verbose Not copying \`$macrodir/argz.m4', libltdl not used.
+fi
+
+func_serial_update  libtool.m4 $aclocaldir $macrodir \
+  LT_INIT 'A[CM]_PROG_LIBTOOL'
+
+if $opt_ltdl; then
+  func_serial_update ltdl.m4 $aclocaldir $macrodir 'LTDL_INIT'
+else
+  func_verbose Not copying \`$macrodir/ltdl.m4', libltdl not used.
+fi
+
+my_save_IFS=$IFS
+IFS=:
+for file in $pkgmacro_files; do
+  IFS=$my_save_IFS
+  func_serial_update $file $aclocaldir $macrodir $file
+done
+IFS=$my_save_IFS
+}
+
+
+# func_install_pkgmacro_files
+# Install copies of the libtool and libltdl m4 macros into this package.
+func_install_pkgmacro_files ()
+{
+$opt_debug
+
+# argz.m4, libtool.m4 and ltdl.m4 are handled specially below:
+func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
+
+  # 1. Parent has separate macrodir to subproject ltdl:
+

Re: 350-gary-maintain-private-libobj-namespace

2008-01-30 Thread Gary V. Vaughan

Hallo Ralf,

[Repost with correct Cc: apologies]

On 30 Jan 2008, at 14:43, Ralf Wildenhues wrote:

* Gary V. Vaughan wrote on Tue, Jan 29, 2008 at 08:44:51AM CET:

On 29 Jan 2008, at 06:45, Ralf Wildenhues wrote:


I haven't reviewed your last two pending patches yet (but I'm not
telling you to wait for me).


Every little helps, even if you don't have time for a thorough  
review...


Your latest version of this patch is so badly mangled as to be
unapplicable.  This is not the first time it happens.  Please
consider sending patches as (text!) attachments, or at least
try to apply patches from your mails to see whether that works.


Sorry, I was pasting the patch into the body since you asked me not
to attach directly as that made it harder to review.  I didn't use
mailnotify because it breaks the thread.

Maybe Mail.app will co-operate if I use a '.txt' extension for the
patch attachments?  Let me know if this is better.  If not, I'll
post with mailnotify, and put up with the broken message threading.


When I try to apply this patch by hand, build and install, get CVS
HEAD GraphicsMagick, and run its bootstrap script, I end up with this
failure, which I assume is due to one of your patches, or to messup
resulting from manual patch application.  Anyway you should look at
it before applying the patch (hint: lt_libobj_prefix seems not set
in configure):

/bin/sh ./libtool --silent --tag=CC   --mode=link gcc -std=gnu99  -g  
-O2 -Wall -pthread -module -avoid-version -L/usr/X11R6/lib -L/usr/ 
lib -L/usr/lib -o ltdl/dlopen.la  ltdl/loaders/dlopen.lo -ldl
make[1]: *** No rule to make target `lt__strl.lo', needed by `ltdl/ 
libltdlc.la'.  Stop.

make[1]: Leaving directory `/tmp/GraphicsMagick/build'
make: *** [all] Error 2


Works for me, I reran bootstrap, and launched a successful VPATH build.
Hopefully, you're just seeing a patch misapplication, otherwise we'll
have to figure out what is different for us.

Actually configure.ac and bootstrap can be cleaned up for (tomorrow's)
libtool-2.1b.  .txt patch attached, and fingers crossed.


Index: b/libltdl/m4/ltdl.m4
===
--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4

[...]

+
+AC_CONFIG_COMMANDS_PRE([
+_ltdl_libobjs=
+_ltdl_ltlibobjs=
+if test -n $_LT_LIBOBJS; then
+  # Remove the extension.
+  sed_drop_objext='s/\.o$//;s/\.obj$//'


This is code that ends up in configure.  sed_drop_objext is not
namespace clean, please prefix with _lt_ or so.


Careless pasting from gnulib-tool.  CCing the gnulib list so they can
fix their version too... gl_sed_drop_objext?


+  for i in `for i in $_LT_LIBOBJS; do echo $i; done | sed
$sed_drop_objext | sort | uniq`; do


`sort -u' is portable.


Tx.  Fixed in the attached.

Cheers,
Gary
--
 ())_.  Email me: [EMAIL PROTECTED]
 ( '/   Read my blog: http://blog.azazil.net
 / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_



from  Gary V. Vaughan  [EMAIL PROTECTED]

* configure.ac: Updated for libtool-2.1b.
* bootstrap (libtoolize): Libtoolize can figure out the mode
and directory for libltdl from configure.ac.

Index: configure.ac
===
RCS file: /GraphicsMagick/GraphicsMagick/configure.ac,v
retrieving revision 1.256
diff -u -r1.256 configure.ac
--- configure.ac19 Jan 2008 21:07:47 -  1.256
+++ configure.ac30 Jan 2008 13:42:01 -
@@ -337,9 +337,8 @@
 AC_SUBST(LIBTOOL_DEPS)
 
 # Configure libltdl
-LT_CONFIG_LTDL_DIR([ltdl],[nonrecursive]) 
-AC_LIBLTDL_CONVENIENCE([ltdl])
-AC_LIB_LTDL
+LT_CONFIG_LTDL_DIR([ltdl])
+LTDL_INIT([convenience nonrecursive])
 # Substitute INCLTDL and LIBLTDL in the Makefiles
 #AC_SUBST(INCLTDL)
 #AC_SUBST(LIBLTDL)

Index: bootstrap
===
RCS file: /GraphicsMagick/GraphicsMagick/bootstrap,v
retrieving revision 1.7
diff -u -r1.7 bootstrap
--- bootstrap   31 Mar 2007 23:07:00 -  1.7
+++ bootstrap   30 Jan 2008 13:44:37 -
@@ -4,7 +4,7 @@
 # Automake or Autoconf is changed.
 #
 
-libtoolize --verbose --copy --force --nonrecursive --ltdl=ltdl
+libtoolize --verbose --copy --force
 # echo 'm4_include([ltdl/m4/lt~obsolete.m4])'  aclocal.m4
 aclocal -I ltdl/m4 -I m4
 autoheader




from  Gary V. Vaughan  [EMAIL PROTECTED]
Unfortunately, the autoconf implementation of AC_LIBOBJ and
friends requires all libobjs to be in the same directory, as
declared by AC_CONFIG_LIBOBJ_DIR.  That might prevent using
either recursive or nonrecursive libltdl if the parent project
has libobjs of its own, except that this patch tracks libltdl's
libobjs in another namespace:

* libltdl/m4/ltdl.m4 (_LT_LIBOBJ, _LT_LIBSOURCES): Versions of
AC_LIBOBJ and AC_LIBSOURCES that save missing sources in a
ltdl_LIBOBJS automake macro, instead of the global 

Re: 350-gary-maintain-private-libobj-namespace

2008-01-28 Thread Gary V. Vaughan

On 29 Jan 2008, at 06:45, Ralf Wildenhues wrote:

Hi Gary,


Hallo Ralf!

Thanks for your comments.


I haven't reviewed your last two pending patches yet (but I'm not
telling you to wait for me).


Every little helps, even if you don't have time for a thorough review...


What caught my eyes though at a glance was this:

* Gary V. Vaughan wrote on Mon, Jan 28, 2008 at 07:38:01PM CET:

 +++ b/libltdl/m4/ltdl-libobj.m4

[...]

 +
 +# Like AC_LIBSOURCES, except the directory where the source file is
 +# expected is separated from the user LIBOBJ directory.
 +AC_DEFUN([_LT_LIBSOURCES], [
 +  m4_foreach([_LTNAME], [$1], [
 +m4_syscmd([test -r libltdl/]_LTNAME[ || test ! -d libltdl/])dnl
 +m4_if(m4_sysval, [0], [],
 +  [AC_FATAL([missing libltdl/]_LTNAME)])
 +  ])
 +])

[...]


 +++ b/libtoolize.m4sh

[...]

 +# func_fixup_ltdl_libobj srcdir destdir
 +func_fixup_ltdl_libobj ()
 +{
 +$opt_debug
 +my_filename=ltdl-libobj.m4
 +my_srcdir=$1
 +my_destdir=$2
 +my_fixup_script=s,libltdl/,$ltdldir/,g
 +
 +$RM $my_destdir/$my_filename 2/dev/null
 +if $opt_dry_run; then :;
 +else
 +  $SED $my_fixup_script \
 + $my_srcdir/$my_filename  $my_destdir/$my_filename ||
 +func_fatal_error cannot create $my_destdir/$my_filename
 +fi
 +}


Changing a m4 file seems very brittle to me.  These files like to get
installed into /usr/share/aclocal, where aclocal can find them even if
you don't want to (and thus if you forget to -I ltdl/m4, you're  
screwed).

Isn't the real name of the libltdl subdirectory name known at autoconf
time anyway?  (This is an honest, not a rhetorical question; I haven't
checked.)


I had thought that it was only available at autoconf time, and since the
ltdl mode is selected at configure time and affects things too went with
the solution I posted earlier.  Evidently, lack of caffeine was clouding
my brain, and the solution is *much* easier now that I've noticed ltdl
mode is selected at libtoolize time, and of course everything we need to
know at configure time is available easily.

Now that there is no need to keep a separate ltdl-libobjs.m4 file for
the substitution stage, a much simplified version of the patch follows
below, and is what I'll be committing in 60 hours or fewer :-)


Probably a good idea to test the libtoolize changes using a ksh.


Done.  No problems.

Cheers,
Gary
--
  ())_.  Email me: [EMAIL PROTECTED]
  ( '/   Read my blog: http://blog.azazil.net
  / )= ...and my book: http://sources.redhat.com/autobook
`(_~)_



  from  Gary V. Vaughan  [EMAIL PROTECTED]

Unfortunately, the autoconf implementation of AC_LIBOBJ and
friends requires all libobjs to be in the same directory, as
declared by AC_CONFIG_LIBOBJ_DIR.  That might prevent using
either recursive or nonrecursive libltdl if the parent project
has libobjs of its own, except that this patch tracks libltdl's
libobjs in another namespace:

* libltdl/m4/ltdl.m4 (_LT_LIBOBJ, _LT_LIBSOURCES): Versions of
AC_LIBOBJ and AC_LIBSOURCES that save missing sources in a
ltdl_LIBOBJS automake macro, instead of the global LIBOBJS
automake macro.  Content of the macros inspired by code from
gnulib-tool.
(_LTDL_MODE_DISPATCH): Initialise lt_libobj_prefix in
nonrecursive mode.
(LTDL_INIT): Push and pop the new definitions around potential
sites that call AC_LIBOBJ.  Also, using lt_libobj_prefix,
initialise ltdl_LIBOBJS and ltdl_LTLIBOBJS.
* libtoolize.m4sh (func_fixup_Makefile): Substitute  
ltdl_LIBOBJS

and ltdl_LTLIBOBJS for LIBOBJS and LTLIBOBJS during copying
either Makefile.am or Makefile.inc, depending on ltdl_mode.
Reported by Eric Blake [EMAIL PROTECTED]

  Index: b/libltdl/m4/ltdl.m4
  ===
  --- a/libltdl/m4/ltdl.m4
  +++ b/libltdl/m4/ltdl.m4
  @@ -198,7 +198,7 @@ m4_if(_LTDL_DIR, [],
   [m4_case(m4_default(_LTDL_MODE, [subproject]),
  [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR)
   
_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])],
  -   [nonrecursive],  
[_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])],
  +   [nonrecursive],  
[_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir;  
lt_libobj_prefix=$lt_ltdl_dir/])],

  [recursive], [],
[m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl
   dnl Be careful not to expand twice:
  @@ -206,6 +206,32 @@ m4_define([$0], [])
   ])# _LTDL_MODE_DISPATCH


  +# _LT_LIBOBJ(MODULE_NAME)
  +# ---
  +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS  
instead

  +# of into LIBOBJS.
  +AC_DEFUN([_LT_LIBOBJ], [
  +  m4_pattern_allow([^_LT_LIBOBJS$])
  +  AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
  +  _LT_LIBOBJS=$_LT_LIBOBJS $1.$ac_objext
  +])# _LT_LIBOBJS
  +
  +
  +# _LT_LIBSOURCES(MODULE_NAMES)