libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eric Blake
Subject: Re: 350-gary-maintain-private-libobj-namespace
Date: Tue, 13 May 2008 22:07:09 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]