libtool-patches
[Top][All Lists]
Advanced

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

Re: 279-gary-LT_CONFIG_LTDL_DIR.diff


From: Gary V. Vaughan
Subject: Re: 279-gary-LT_CONFIG_LTDL_DIR.diff
Date: Thu, 29 Sep 2005 10:19:41 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20050305)

Ralf Wildenhues wrote:
Hi Gary,

Hallo Ralf,

Thanks for the review.  New version of the patch attached.

* Gary V. Vaughan wrote on Tue, Sep 27, 2005 at 03:36:43PM CEST:
I'm not sure I understand how the aclocal.m4 problem came
to be:

(The aclocal.m4 problem is orthogonal; let's discuss it elsewhere).

Okay.  I'd like to fix this in a separate patch.

First, LT_WITH_LTDL and --with-included-ltdl leads to
  LIBLTDL = ${top_builddir}/ltdl//libltdlc.la

which is just a tad ugly (because of the doubled slash).  Can we avoid
it, and just omit all those trailing slashes added?

Yes.  Fixed.

Then, there's a bug: --without-included-ltdl leads to
| checking for ltdl.h... yes
| checking for lt_dlcaller_register in -lltdl... yes
| checking whether to use included libltdl... no

and
| LIBLTDL = -lltdl
...
| LTDLINCL = -I${top_srcdir}/ltdl/

which is wrong -- the include path should not be changed here.
I'll provide a few more data points to reproduce this (it's ok if you
want to fix this in a separate patch).

I've fixed it here.  Nice catch btw. :-)

+correctly.  Unfortunately, this method has problems if you then try to
+link the package binaries with an installed libltdl, or a library that
+depends on libltdl, because of the duplicate symbol definitions.
+Ensuring that only one copy of the libltdl sources are linked into any
+program is left as an exercise for the reader.

Hmm.  You meant "so don't do that then", right?
IOW: linking simultaneously against two different libltdl versions is
bad, and linking simultaneously against an installed and a local libltdl
(be that convenience or not) is bad, too.

Improved the wording.  Thanks.

+       [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `$1`])])])

"quotes" don't match: `$1'.

Ahh..  D'oh.  I've changed this a bit in the new patch, but fixed the
quote too.  Thanks.

+  # If the included ltdl is not to be used. then Use the

wrong punctuation and capitalization.

Fixed.

+# -l, --ltdl[=DIR]      install libltdl sources [[default: libltdl]]

AFAICS the double quotes are superfluous.

Yes, they were.  Removed.

Also, I'm not so sure `-l' as abbreviation is such a good idea for
`--ltdl'.  What if we later want to --list something, or have an idea
of something local or long?  --ltdl is not much to type, and the list
of short option abbreviations in GCS does not list a similar precedent.

Okay.  Removed -l.

+    # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
+    # `libltdl'.  If both are specified, they must be the same.  Otherwise,
+    # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
+    # we suggest adding it later in this code.)
+    case x$ac_ltdldir,x$ltdldir in
+      x,x)     ltdldir=libltdl         ;;
+      x*,x)    ltdldir=$ac_ltdldir     ;;
+      x,x*)    ltdldir=$ltdldir        ;;
+      *)
+        test x"$ac_ltdldir" = x"$ltdldir" || \
+           func_fatal_error "--ltdl='$ltdldir' does not match 
LT_CONFIG_LTDL_DIR($ac_ltdldir)"

Hmm. If I
  LT_CONFIG_LTDL_DIR(ltdl/)
and
  libtoolize --ltdl=ltdl/
then it'll barf.  Probably ok, I just noticed it.

Oh, good point.  Fixed.

Okay to commit?

Cheers,
        Gary.
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
This changeset brings some sanity to tracking the directory name for
libltdl sources.  Old syntax still works, but the documentation now
talks only about using the new LT_CONFIG_LTDL_DIR.  If any of the old
macros are still given a directory argument, it is set as before, only
now autoconf will stop with an error if there is a conflict.

 NEWS                 |    1
 doc/libtool.texi     |   74 +++++++++-------
 libltdl/configure.ac |    1
 NEWS                 |    1 
 doc/libtool.texi     |   76 ++++++++-------
 libltdl/configure.ac |    1 
 libltdl/m4/ltdl.m4   |  251 ++++++++++++++++++++++++++++++++-------------------
 libtoolize.m4sh      |   83 +++++++++++++---
 5 files changed, 271 insertions(+), 141 deletions(-)

Index: libtool--devo--1.0/ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * libltdl/m4/ltdl.m4: Bump serial as we are changing the
        interface.
        (LT_CONFIG_LTDL_DIR): New macro to centralise setting the
        subdirectory used for libltdl.
        (LTDL_CONVENIENCE): Continue backwards compatibility support for
        declaring the libltdl source subdirectory with an argument, but
        defer to LT_CONFIG_LTDL_DIR.
        (AC_LIBLTDL_CONVENIENCE): Adjust to upgrade to the new style.
        (LTDL_INSTALLABLE, AC_LIBLTDL_INSTALLABLE): Ditto.
        (LTDL_INIT): lt_ltdl_dir is set by LT_CONFIG_LTDL_DIR now, and
        even `./' needs trailing slashes trimming!  If the user didn't
        upgrade their configure.ac yet, call LT_CONFIG_LTDL_DIR for them.
        * libtoolize.m4sh (func_scan_files): If --ltdl option is given
        without a directory argument, use the value from
        LT_CONFIG_LTDL_DIR; if the argument is given, and there is also a
        value in LT_CONFIG_LTDL_DIR, ensure they are the same.
        * libltdl/configure.ac: Use it.
        * NEWS: Updated.

Index: libtool--devo--1.0/NEWS
===================================================================
--- libtool--devo--1.0.orig/NEWS
+++ libtool--devo--1.0/NEWS
@@ -3,6 +3,7 @@ NEWS - list of user-visible changes betw
 New in 1.9h: 2005-??-??; CVS version 2.1a, Libtool team:
 * New tests for support of Automake subdir-objects.
 * Fix libltdl on static platforms.
+* New LT_CONFIG_LTDL_DIR macro.
 * New multi-module-loader safe libltdl handle iteration APIs:
   lt_dlhandle_iterate, lt_dlhandle_fetch, lt_dlhandle_map.
 * New lt_dlinterface_register to maintain separation of concerns between
Index: libtool--devo--1.0/doc/libtool.texi
===================================================================
--- libtool--devo--1.0.orig/doc/libtool.texi
+++ libtool--devo--1.0/doc/libtool.texi
@@ -2243,12 +2243,11 @@ Display a help message and exit.
 
 @item --ltdl address@hidden
 Install libltdl in a the @var{TARGET-DIRECTORY-NAME} subdirectory of
-your package.  If you specify a subdirectory name, then you will need
-to be careful to pass the same directory name to the autoconf macros:
address@hidden; @code{LTDL_CONVENIENCE};
address@hidden (@pxref{Distributing libltdl}).  Without
-an argument, @samp{libltdl} is used as the default target directory
-name.
+your package.  Normally, the directory is extracted from the argument
+to @code{LT_CONFIG_LTDL_DIR} in @file{configure.ac}, though you can
+also specify a subdirectory name here if you are not using Autoconf
+for example.  If @command{libtoolize} can't determine the target
+directory, @samp{libltdl} is used as the default.
 
 @item --quiet
 @itemx -q
@@ -4133,34 +4132,41 @@ release of libltdl.
 }.  Having made the macros available, you must add a call to the
 @samp{LT_WITH_LTDL} macro to your package's @file{configure.ac} to
 perform the configure time checks required to build the library
-correctly.  This method has problems if you then try to link the
-package binaries with an installed libltdl, or a library that depends
-on libltdl: you will have problems with duplicate symbol definitions.
+correctly.  Unfortunately, this method has problems if you then try to
+link the package binaries with an installed libltdl, or a library that
+depends on libltdl, because of the duplicate symbol definitions.  For
+example, ultimately linking against two different versions of libltdl,
+or against both a local convenience library and an installed libltdl
+is bad.  Ensuring that only one copy of the libltdl sources are linked
+into any program is left as an exercise for the reader.
+
address@hidden LT_CONFIG_LTDL_DIR (@var{DIRECTORY})
+Declare @var{DIRECTORY} to be the location of the @code{libltdl}
+source files, for @command{libtoolize --ltdl} to place
+them. @xref{Invoking libtoolize}, for more details.
address@hidden defmac
 
address@hidden LT_WITH_LTDL (@var{DIRECTORY})
address@hidden LT_WITH_LTDL
 Add the @option{--with-included-ltdl} option to the @file{configure}
-script.  By default, this macro will try to build @code{libltdl} in
-a subdirectory named @file{libltdl}, which is where
address@hidden --ltdl} will place the files unless directed
-differently. @xref{Invoking libtoolize}, for how to do that.
-Otherwise, use @var{DIRECTORY} to pass the location of the
address@hidden source files.
+script.  This option will then allow the person who builds your
+package to choose between linking against an already installed
address@hidden (@option{--without-included-ltdl}), or the sources
+shipped with the package in the subdirectory named by
address@hidden (@option{--with-included-ltdl}).
 @end defmac
 
address@hidden LTDL_INSTALLABLE (@var{DIRECTORY})
address@hidden LTDL_INSTALLABLE
 If there is an installed @code{libltdl}, then set @code{LIBLTDL} to the
 link flags needed to use it, and @code{LTDLINCL} to the preprocessor
 flags needed to find the installed headers.  Otherwise, set them to
 point into an included version of @code{libltdl}, and install that.
 
-By default, this macro will pass options to the @file{libltdl}
-subdirectory @file{configure} to cause it to be built as an
-installable library.  If you named the @code{libltdl} source directory
-differently, then pass the directory name relative to
address@hidden as @var{DIRECTORY}.  If you're not using automake,
-you will need to define @code{top_builddir} and @code{top_srcdir} in
-your makefile so that @code{LIBLTDL} and @code{LTDLINCL} are expanded
-properly.
+By default, this macro will pass options to the @file{configure}
+script in the subdirectory named by @code{LT_CONFIG_LTDL_DIR} in order
+to cause it to be built as an installable library.  If you're not
+using automake, you will need to define @code{top_builddir} and
address@hidden in your makefile so that @code{LIBLTDL} and
address@hidden are expanded properly.
 
 If used in conjunction with @code{LT_WITH_LTDL}, this macro must
 appear @strong{before} the call to @code{LT_WITH_LTDL}.  If you are
@@ -4168,17 +4174,18 @@ not using @code{LT_WITH_LTDL}, then you 
 @code{AC_CONFIG_SUBDIRS(@var{DIRECTORY})} to your @file{configure.ac}.
 @end defmac
 
address@hidden LTDL_CONVENIENCE (@var{DIRECTORY})
address@hidden LTDL_CONVENIENCE
 Unless you call @code{LTDL_INSTALLABLE} before hand,
 @code{LT_WITH_LTDL} calls this macro automatically, so you should only
 ever need to use it yourself if @code{LT_WITH_LTDL} doesn't do what
 you want.
 
-By default, this macro will pass options to the @file{libltdl}
-subdirectory @file{configure} to cause it to be built as a convenience
-library.  If you put the @code{libltdl} sources in a different
-subdirectory, then you should tell @code{LTDL_CONVENIENCE} where
-with the @var{DIRECTORY} parameter.
+By default, this macro will pass options to the @file{configure}
+script in the subdirectory named by @code{LT_CONFIG_LTDL_DIR} in order
+to cause it to be built as a convenience library.  If you're not
+using automake, you will need to define @code{top_builddir} and
address@hidden in your makefile so that @code{LIBLTDL} and
address@hidden are expanded properly.
 @end defmac
 
 One advantage of the convenience library is that it is not installed,
@@ -4211,8 +4218,8 @@ switch @option{--enable-ltdl-install}.
 Whatever macro you use, it is up to you to ensure that your
 @file{configure.ac} will configure libltdl by using
 @samp{LT_WITH_LTDL}.  Both macros define the shell variables
address@hidden, to the link flag that you should use to link with
-libltdl, and @var{LTDLINCL}, to the preprocessor flag that you should
address@hidden to the link flag that you should use to link with
+libltdl, and @var{LTDLINCL} to the preprocessor flag that you should
 use to compile with programs that include @file{ltdl.h}.
 
 If you're using the convenience libltdl, @var{LIBLTDL} will be the
@@ -4255,6 +4262,9 @@ assume that libltdl was embedded using @
 configure.ac:
 @example
 ...
+# Name the subdirectory that contains libltdl sources
+LT_CONFIG_LTDL_DIR([libltdl])
+
 ## ------------------------------------------ ##
 ## Enable building of the installable library ##
 ## ------------------------------------------ ##
Index: libtool--devo--1.0/libltdl/configure.ac
===================================================================
--- libtool--devo--1.0.orig/libltdl/configure.ac
+++ libtool--devo--1.0/libltdl/configure.ac
@@ -33,6 +33,7 @@ AC_CONFIG_HEADERS([config.h:config-h.in]
 AC_CONFIG_SRCDIR([ltdl.c])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([m4])
+LT_CONFIG_LTDL_DIR([.]) # I am me!
 
 
 ## ---------------------------------------- ##
Index: libtool--devo--1.0/libltdl/m4/ltdl.m4
===================================================================
--- libtool--devo--1.0.orig/libltdl/m4/ltdl.m4
+++ libtool--devo--1.0/libltdl/m4/ltdl.m4
@@ -5,77 +5,59 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 8 LTDL_INIT
+# serial 9 LTDL_INIT
 
-# LT_WITH_LTDL([DIRECTORY])
-# -------------------------
-# Clients of libltdl can use this macro to allow the installer to
-# choose between a shipped copy of the ltdl sources or a preinstalled
-# version of the library.
-AC_DEFUN([LT_WITH_LTDL],
-[AC_ARG_WITH([included_ltdl],
-    [AS_HELP_STRING([--with-included-ltdl],
-                    [use the GNU ltdl sources included here])])
-
-if test "x$with_included_ltdl" != xyes; then
-  # We are not being forced to use the included libltdl sources, so
-  # decide whether there is a useful installed version we can use.
-  AC_CHECK_HEADER([ltdl.h],
-      [AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
-          [with_included_ltdl=no],
-          [with_included_ltdl=yes])],
-
-      [],
-      [AC_INCLUDES_DEFAULT]
-  )
-fi
-
-if test "x$enable_ltdl_install" != xyes; then
-  # If the user did not specify an installable libltdl, then default
-  # to a convenience lib.
-  LTDL_CONVENIENCE(m4_default([$1], [libltdl]))
-fi
-
-if test "x$with_included_ltdl" = xno; then
-  # If the included ltdl is not to be used. then Use the
-  # preinstalled libltdl we found.
-  AC_DEFINE([HAVE_LTDL], [1],
-    [Define this if a modern libltdl is already installed])
-  LIBLTDL=-lltdl
-fi
-
-# Report our decision...
-AC_MSG_CHECKING([whether to use included libltdl])
-AC_MSG_RESULT([$with_included_ltdl])
-
-AC_CONFIG_SUBDIRS(m4_default([$1], [libltdl]))
-])# LT_WITH_LTDL
+# LT_CONFIG_LTDL_DIR(DIRECTORY)
+# -----------------------------
+# DIRECTORY contains the libltdl sources.  It is okay to call this
+# function multiple times, as long as the same DIRECTORY is always given.
+AC_DEFUN([LT_CONFIG_LTDL_DIR],
+[AC_BEFORE([$0], [LT_WITH_LTDL])
+_$0($*)
+])# LT_CONFIG_LTDL_DIR
+
+# We break this out into a separate macro, so that we can call it safely
+# internally without being caught accidentally by the sed scan in libtoolize.
+m4_defun([_LT_CONFIG_LTDL_DIR],
+[m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$]))
+m4_case(_LTDL_DIR,
+       [], [m4_define([_LTDL_DIR], _ARG_DIR)
+           _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])],
+    [m4_if(_ARG_DIR, _LTDL_DIR,
+           [],
+       [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', 
`]_ARG_DIR['])])])
+])
 
-# Old name:
-AU_ALIAS([AC_WITH_LTDL], [LT_WITH_LTDL])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_WITH_LTDL], [])
+# Initialise:
+m4_define([_LTDL_DIR], [])
 
 
-# LTDL_CONVENIENCE([DIRECTORY])
-# -----------------------------
+# LTDL_CONVENIENCE
+# ----------------
 # sets LIBLTDL to the link flags for the libltdl convenience library and
 # LTDLINCL to the include flags for the libltdl header and adds
 # --enable-ltdl-convenience to the configure arguments.  Note that
-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
-# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# AC_CONFIG_SUBDIRS is not called here.  LIBLTDL will be prefixed with
 # '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
 # (note the single quotes!).  If your package is not flat and you're not
 # using automake, define top_builddir and top_srcdir appropriately in
-# the Makefiles.
+# your Makefiles.
 AC_DEFUN([LTDL_CONVENIENCE],
-[case $enable_ltdl_convenience in
+[AC_BEFORE([$0], [LT_WITH_LTDL])dnl
+dnl Although the argument is deprecated and no longer documented,
+dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one
+dnl here make sure it is the same as any other declaration of libltdl's
+dnl location!  This also ensures lt_ltdl_dir is set when configure.ac is
+dnl not yet using an explicit LT_CONFIG_LTDL_DIR.
+m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl
+
+case $enable_ltdl_convenience in
   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
   "") enable_ltdl_convenience=yes
       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
   esac
-LIBLTDL='${top_builddir}/'m4_default([$1], [libltdl])/libltdlc.la
-LTDLINCL='-I${top_srcdir}/'m4_default([$1], [libltdl])
+LIBLTDL='${top_builddir}/'"$lt_ltdl_dir/libltdlc.la"
+LTDLINCL='-I${top_srcdir}/'"$lt_ltdl_dir"
 
 AC_SUBST([LIBLTDL])
 AC_SUBST([LTDLINCL])
@@ -85,26 +67,37 @@ INCLTDL="$LTDLINCL"
 AC_SUBST([INCLTDL])
 ])# LTDL_CONVENIENCE
 
-# Old name:
-AU_ALIAS([AC_LIBLTDL_CONVENIENCE], [LTDL_CONVENIENCE])
+# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools,
+# now we have LT_CONFIG_LTDL_DIR:
+AU_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[_LT_CONFIG_LTDL_DIR([$1])
+LTDL_CONVENIENCE])
+
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [])
 
 
-# LTDL_INSTALLABLE([DIRECTORY])
-# -----------------------------
-# sets LIBLTDL to the link flags for the libltdl installable library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-install to the configure arguments.  Note that LIBLTDL
-# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If
-# DIRECTORY is not provided and an installed libltdl is not found, it is
-# assumed to be `libltdl'.  LIBLTDL will be prefixed with '${top_builddir}/'
+# LTDL_INSTALLABLE
+# ----------------
+# sets LIBLTDL to the link flags for the libltdl installable library
+# and LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called from here.  If an installed libltdl
+# is not found, LIBLTDL will be prefixed with '${top_builddir}/'
 # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single
 # quotes!).  If your package is not flat and you're not using automake,
-# define top_builddir and top_srcdir appropriately in the Makefiles.
+# define top_builddir and top_srcdir appropriately in your Makefiles.
 # In the future, this macro may have to be called after LT_INIT.
 AC_DEFUN([LTDL_INSTALLABLE],
-[AC_CHECK_LIB(ltdl, lt_dlinit,
+[AC_BEFORE([$0], [LT_WITH_LTDL])dnl
+dnl Although the argument is deprecated and no longer documented,
+dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one
+dnl here make sure it is the same as any other declaration of libltdl's
+dnl location!  This also ensures lt_ltdl_dir is set when configure.ac is
+dnl not yet using an explicit LT_CONFIG_LTDL_DIR.
+m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl
+
+AC_CHECK_LIB(ltdl, lt_dlinit,
   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
   [if test x"$enable_ltdl_install" = xno; then
      AC_MSG_WARN([libltdl not installed, but installation disabled])
@@ -114,8 +107,8 @@ AC_DEFUN([LTDL_INSTALLABLE],
   ])
 if test x"$enable_ltdl_install" = x"yes"; then
   ac_configure_args="$ac_configure_args --enable-ltdl-install"
-  LIBLTDL='${top_builddir}/'m4_default([$1], [libltdl])/libltdl.la
-  LTDLINCL='-I${top_srcdir}/'m4_default([$1], [libltdl])
+  LIBLTDL='${top_builddir}/'"$lt_ltdl_dir/libltdl.la"
+  LTDLINCL='-I${top_srcdir}/'"$lt_ltdl_dir"
 else
   ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
   LIBLTDL="-lltdl"
@@ -130,23 +123,88 @@ INCLTDL="$LTDLINCL"
 AC_SUBST([INCLTDL])
 ])# LTDL_INSTALLABLE
 
-# Old name:
-AU_ALIAS([AC_LIBLTDL_INSTALLABLE], [LTDL_INSTALLABLE])
+# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools,
+# now we have LT_CONFIG_LTDL_DIR:
+AU_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[_LT_CONFIG_LTDL_DIR([$1])
+LTDL_INSTALLABLE])
+
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], [])
 
 
-# LTDL_INIT([DIRECTORY])
-# ----------------------
+# LT_WITH_LTDL
+# ------------
+# Clients of libltdl can use this macro to allow the installer to
+# choose between a shipped copy of the ltdl sources or a preinstalled
+# version of the library.  If the shipped ltdl sources are not in a
+# subdirectory named libltdl, the directory name must be given by
+# LT_CONFIG_LTDL_DIR.
+AC_DEFUN([LT_WITH_LTDL],
+[dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE
+dnl was called yet, then for old times' sake, we assume libltdl is in an
+dnl eponymous directory:
+AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])])
+
+AC_ARG_WITH([included_ltdl],
+    [AS_HELP_STRING([--with-included-ltdl],
+                    [use the GNU ltdl sources included here])])
+
+if test "x$with_included_ltdl" != xyes; then
+  # We are not being forced to use the included libltdl sources, so
+  # decide whether there is a useful installed version we can use.
+  AC_CHECK_HEADER([ltdl.h],
+      [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
+          [with_included_ltdl=no],
+          [with_included_ltdl=yes])],
+
+      [],
+      [AC_INCLUDES_DEFAULT]
+  )
+fi
+
+if test "x$enable_ltdl_install" != xyes; then
+  # If the user did not specify an installable libltdl, then default
+  # to a convenience lib.
+  LTDL_CONVENIENCE
+fi
+
+if test "x$with_included_ltdl" = xno; then
+  # If the included ltdl is not to be used, then use the
+  # preinstalled libltdl we found.
+  AC_DEFINE([HAVE_LTDL], [1],
+    [Define this if a modern libltdl is already installed])
+  LIBLTDL=-lltdl
+  LTDLINCL=
+fi
+
+# Report our decision...
+AC_MSG_CHECKING([whether to use included libltdl])
+AC_MSG_RESULT([$with_included_ltdl])
+
+AC_CONFIG_SUBDIRS([_LTDL_DIR])
+
+dnl Be certain that LTDL_INIT is invoked:
+AC_PROVIDE_IFELSE([LTDL_INIT],
+       [],
+    [LTDL_INIT
+    AC_DEFUN([LTDL_INIT], [])])
+])# LT_WITH_LTDL
+
+# Old name:
+AU_ALIAS([AC_WITH_LTDL], [LT_WITH_LTDL])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_WITH_LTDL], [])
+
+
+# LTDL_INIT
+# ---------
 # Perform all the checks necessary for compilation of the ltdl objects
-#  -- including compiler checks and header checks.
+#  -- including compiler checks and header checks.  This is a public
+# interface  mainly for the benefit of libltdl's own configure.ac, most
+# other users should call LT_WITH_LTDL instead.
 AC_DEFUN([LTDL_INIT],
-[m4_ifval([$1], [m4_divert_push([DEFAULTS])dnl
-# libltdl will be built in the named DIRECTORY, relative to $top_builddir.
-lt_ltdl_dir='$1'
-m4_divert_pop([DEFAULTS])])dnl
-
-AC_REQUIRE([AC_PROG_CC])dnl
+[AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_C_CONST])dnl
 AC_REQUIRE([AC_HEADER_STDC])dnl
 AC_REQUIRE([AC_HEADER_DIRENT])dnl
@@ -164,6 +222,16 @@ m4_require([_LT_HEADER_DLFCN])dnl
 m4_require([_LT_ENABLE_INSTALL])dnl
 m4_require([_LT_CHECK_DLPREOPEN])dnl
 
+dnl Although deprecated and no longer documented, alpha releases of
+dnl libtool used to define an LTDL_INIT to take a DIRECTORY orgument.
+dnl If LT_CONFIG_LTDL_DIR was called already, but LTDL_INIT was given a
+dnl DIRECTORY argument, check it is the same as previous invocations.  If
+dnl it still hasn't been called, then do it now, defaulting to `libltdl'
+dnl if no DIRECTORY argument was passed.
+m4_provide_if([_LT_CONFIG_LTDL_DIR],
+       [m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])],
+    [_LT_CONFIG_LTDL_DIR(m4_default([$1], [libltdl]))])dnl
+
 # In order that ltdl.c can compile, run AC_CONFIG_HEADERS for the user
 # if they did not call it themself.  This is so that ltdl.h can pick up
 # the parent projects config.h file, The first file in AC_CONFIG_HEADERS
@@ -393,9 +461,6 @@ AC_DEFUN([LT_LIB_DLLOAD],
 LT_DLLOADERS=
 AC_SUBST([LT_DLLOADERS])
 
-test "X${lt_ltdl_dir-.}" != X. &&
-    lt_ltdl_dir=`echo "$lt_ltdl_dir/" | sed 's,/*$,/,'`
-
 AC_LANG_PUSH([C])
 
 LIBADD_DLOPEN=
@@ -403,7 +468,7 @@ AC_CHECK_LIB([dl], [dlopen],
        [AC_DEFINE([HAVE_LIBDL], [1],
                   [Define if you have the libdl library or equivalent.])
        LIBADD_DLOPEN="-ldl" libltdl_cv_lib_dl_dlopen="yes"
-       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"],
+       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"],
     [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H
 #  include <dlfcn.h>
 #endif
@@ -411,12 +476,12 @@ AC_CHECK_LIB([dl], [dlopen],
            [AC_DEFINE([HAVE_LIBDL], [1],
                       [Define if you have the libdl library or equivalent.])
            libltdl_cv_func_dlopen="yes"
-           LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"],
+           LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"],
        [AC_CHECK_LIB([svld], [dlopen],
                [AC_DEFINE([HAVE_LIBDL], [1],
                         [Define if you have the libdl library or equivalent.])
                LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes"
-               LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"])])])
+               LT_DLLOADERS="$LT_DLLOADERS 
${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"])])])
 if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" 
= xyes
 then
   lt_save_LIBS="$LIBS"
@@ -430,11 +495,11 @@ LIBADD_SHL_LOAD=
 AC_CHECK_FUNC([shl_load],
        [AC_DEFINE([HAVE_SHL_LOAD], [1],
                   [Define if you have the shl_load function.])
-       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}shl_load.la"],
+       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}shl_load.la"],
     [AC_CHECK_LIB([dld], [shl_load],
            [AC_DEFINE([HAVE_SHL_LOAD], [1],
                       [Define if you have the shl_load function.])
-           LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}shl_load.la"
+           LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}shl_load.la"
            LIBADD_SHL_LOAD="-ldld"])])
 AC_SUBST([LIBADD_SHL_LOAD])
 
@@ -444,20 +509,20 @@ darwin[[1567]].*)
   AC_CHECK_FUNC([_dyld_func_lookup],
        [AC_DEFINE([HAVE_DYLD], [1],
                   [Define if you have the _dyld_func_lookup function.])
-       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dyld.la"])
+       LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dyld.la"])
   ;;
 beos*)
-  LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}load_add_on.la"
+  LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}load_add_on.la"
   ;;
 cygwin* | mingw* | os2* | pw32*)
-  LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}loadlibrary.la"
+  LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}loadlibrary.la"
   ;;
 esac
 
 AC_CHECK_LIB([dld], [dld_link],
        [AC_DEFINE([HAVE_DLD], [1],
                   [Define if you have the GNU dld library.])
-               LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dld_link.la"])
+               LT_DLLOADERS="$LT_DLLOADERS 
${lt_ltdl_dir+$lt_ltdl_dir/}dld_link.la"])
 AC_SUBST([LIBADD_DLD_LINK])
 
 m4_pattern_allow([^LT_DLPREOPEN$])
Index: libtool--devo--1.0/libtoolize.m4sh
===================================================================
--- libtool--devo--1.0.orig/libtoolize.m4sh
+++ libtool--devo--1.0/libtoolize.m4sh
@@ -39,7 +39,7 @@ m4_divert_push([SCRIPT])#! /bin/sh
 # -n, --dry-run         print commands rather than running them
 # -f, --force           replace existing files
 # -i, --install         copy missing auxiliary files
-#     --ltdl[=DIR]      install libltdl in a subdirectory [default: libltdl]
+#     --ltdl[=DIR]      install libltdl sources [default: libltdl]
 # -q, --quiet           work silently
 # -v, --verbose         verbosely report processing
 #     --version         print version information and exit
@@ -68,10 +68,11 @@ $as_unset CDPATH
 m4_include([getopt.m4sh])
 
 # Command line options:
+opt_debug=:
 opt_force=false
 opt_install=false
 opt_link=:
-opt_debug=:
+opt_ltdl=false
 
 seen_autoconf=false
 seen_libtool=false
@@ -123,11 +124,13 @@ configure_ac=configure.in
 
       --install|-i)    opt_install=: ;;
 
-      --ltdl)          ltdldir=libltdl
+      --ltdl)          opt_ltdl=:
                        if test "$#" -gt 0; then
                          case $1 in
-                           -*)                         ;;
-                           *)  ltdldir="$1"; shift     ;;
+                           -*) ;;
+                           *)  ltdldir=`$ECHO "X$1" | $Xsed -e 's,/*$,,'`
+                               shift
+                               ;;
                          esac
                        fi
                        ;;
@@ -146,8 +149,16 @@ configure_ac=configure.in
                        shift
                        ;;
 
+      # Separate optargs to short options:
+      #-X*)
+      #                        arg=`$ECHO "X$opt" | $Xsed -e 
"$my_sed_single_rest"`
+      #                        opt=`$ECHO "X$opt" | $Xsed -e 
"$my_sed_single_opt"`
+      #                        set dummy "$opt" "$arg" ${1+"$@"}
+      #                        shift
+      #                        ;;
+
       # Separate non-argument short options:
-      -c*|-i*|-f*|-n*|-q*|-v*)
+      -c*|-f*|-i*|-n*|-q*|-v*)
                        rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
                        opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
                        set dummy "$opt" "-$rest" ${1+"$@"}
@@ -354,6 +365,9 @@ func_scan_files ()
        my_configure_ac=
        test -n "$configure_ac" && my_configure_ac="$configure_ac: "
         func_verbose "${my_configure_ac}not using Autoconf"
+
+       # Make sure ltdldir is set, even though we return early here:
+       test -n "$ltdldir" || ltdldir=libltdl
        return
     }
 
@@ -370,6 +384,10 @@ func_scan_files ()
        /AC_CONFIG_MACRO_DIR(/ {
            s,^.*AC_CONFIG_MACRO_DIR([[[        ]*\([^])]]*\).*$,macrodir=\1,; 
p;
         };
+       /_LT_CONFIG_LTDL_DIR(/d;
+       /LT_CONFIG_LTDL_DIR(/ {
+           s,^.*LT_CONFIG_LTDL_DIR([[[  ]*\([^])]]*\).*$,ac_ltdldir=\1,; p;
+       };
        /A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
        /LT_INIT/            { s,^.*$,seen_libtool=:,; p; };
        /LTDL_INIT/          { s,^.*$,seen_ltdl=:,; p; };
@@ -380,6 +398,35 @@ func_scan_files ()
     eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
 
 
+    # ----------------- #
+    # Validate ltdldir. #
+    # ----------------- #
+
+    ac_ltdldir=`$ECHO "X$ac_ltdldir" | $Xsed -e 's,/*$,,'`
+
+    # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
+    # not given in terms of a shell variable!
+    case "$ac_ltdldir" in
+      *\$*)
+        func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
+        ;;
+    esac
+
+    # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
+    # `libltdl'.  If both are specified, they must be the same.  Otherwise,
+    # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
+    # we suggest adding it later in this code.)
+    case x$ac_ltdldir,x$ltdldir in
+      x,x)     ltdldir=libltdl         ;;
+      x*,x)    ltdldir=$ac_ltdldir     ;;
+      x,x*)    ltdldir=$ltdldir        ;;
+      *)
+        test x"$ac_ltdldir" = x"$ltdldir" || \
+           func_fatal_error "--ltdl='$ltdldir' does not match 
LT_CONFIG_LTDL_DIR($ac_ltdldir)"
+       ;;
+    esac
+
+
     # ---------------- #
     # Validate auxdir. #
     # ---------------- #
@@ -899,7 +946,7 @@ func_nonemptydir_p ()
 
   # Copy all the files from installed libltdl to this project, if the
   # user specified `--ltdl'.
-  if test -n "$ltdldir"; then
+  if $opt_ltdl; then
     func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
 
     # Unless we share CONFIG_MACRO_DIR with our parent project,
@@ -962,14 +1009,20 @@ func_nonemptydir_p ()
       fi
     fi
 
-  # Offer some suggestions for avoiding duplicate files in a project
-  # that uses libltdl:
-  if test -n "$ltdldir" && $seen_autoconf; then
-    $opt_quiet || test "$ltdldir/config" = "$auxdir" || \
-      func_echo "consider using \`AC_CONFIG_AUX_DIR([[$ltdldir/config]])' in 
$configure_ac"
-    $opt_quiet || test "$ltdldir/m4" = "$m4dir" || \
-      func_echo "consider using \`AC_CONFIG_MACRO_DIR([[$ltdldir/m4]])' in 
$configure_ac"
-  fi
+  $opt_quiet || \
+    if $opt_ltdl && $seen_autoconf; then
+
+      # Remind the user to call LT_CONFIG_LTDL_DIR:
+      test -n "$ac_ltdldir" || \
+        func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([[$ltdldir]])' to 
\`$configure_ac'"
+
+      # Offer some suggestions for avoiding duplicate files in a project
+      # that uses libltdl:
+      test "$ltdldir/config" = "$auxdir" || \
+        func_echo "consider using \`AC_CONFIG_AUX_DIR([[$ltdldir/config]])' in 
$configure_ac"
+      test "$ltdldir/m4" = "$m4dir" || \
+        func_echo "consider using \`AC_CONFIG_MACRO_DIR([[$ltdldir/m4]])' in 
$configure_ac"
+    fi
 }
 
 exit $exit_status

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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