libtool-patches
[Top][All Lists]
Advanced

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

279-gary-LT_CONFIG_LTDL_DIR.diff


From: Gary V. Vaughan
Subject: 279-gary-LT_CONFIG_LTDL_DIR.diff
Date: Fri, 23 Sep 2005 13:26:24 +0100
User-agent: quilt/0.42-1

Here is the first part of the patch series to fix the LT_WITH_INIT
interfaces.  Okay to commit?

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
 libltdl/m4/ltdl.m4   |  225 ++++++++++++++++++++++++++++++++-------------------
 libtoolize.m4sh      |   74 +++++++++++++---
 5 files changed, 246 insertions(+), 129 deletions(-)

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,39 @@ 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.
+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 +4172,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 +4216,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 +4260,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,52 @@
 # 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
+# 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])
+m4_case(_LTDL_DIR,
+       [], [m4_define([_LTDL_DIR], [$1])
+           _LT_SHELL_INIT([lt_ltdl_dir='$1'])],
+    [m4_if($1, _LTDL_DIR,
+           [],
+       [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `$1`])])])
+])
 
-# Report our decision...
-AC_MSG_CHECKING([whether to use included libltdl])
-AC_MSG_RESULT([$with_included_ltdl])
+# Initialise:
+m4_define([_LTDL_DIR], [])
 
-AC_CONFIG_SUBDIRS(m4_default([$1], [libltdl]))
-])# 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_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 +60,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 +100,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 +116,87 @@ 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_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
+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([_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 +214,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.
+AC_PROVIDE_IFELSE([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,8 +453,7 @@ 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,/*$,/,'`
+lt_ltdl_dir=`echo "${lt_ltdl_dir-.}/" | sed 's,/*$,/,'`
 
 AC_LANG_PUSH([C])
 
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]
+# -l, --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,7 +124,7 @@ configure_ac=configure.in
 
       --install|-i)    opt_install=: ;;
 
-      --ltdl)          ltdldir=libltdl
+      --ltdl|-l)       opt_ltdl=:
                        if test "$#" -gt 0; then
                          case $1 in
                            -*)                         ;;
@@ -146,8 +147,16 @@ configure_ac=configure.in
                        shift
                        ;;
 
+      # Separate optargs to short options:
+      -l*)
+                       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 +363,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 +382,9 @@ func_scan_files ()
        /AC_CONFIG_MACRO_DIR(/ {
            s,^.*AC_CONFIG_MACRO_DIR([[[        ]*\([^])]]*\).*$,macrodir=\1,; 
p;
         };
+       /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 +395,33 @@ func_scan_files ()
     eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
 
 
+    # ----------------- #
+    # Validate ltdldir. #
+    # ----------------- #
+
+    # 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. #
     # ---------------- #
@@ -905,7 +947,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,
@@ -966,14 +1008,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
-- 
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




reply via email to

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