]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Move libltdl build mode options from LT_CONFIG_LTDL_DIR to
authorGary V. Vaughan <gary@gnu.org>
Sun, 6 Jan 2008 16:33:31 +0000 (16:33 +0000)
committerGary V. Vaughan <gary@gnu.org>
Sun, 6 Jan 2008 16:33:31 +0000 (16:33 +0000)
LTDL_INIT.  Accept (optional) new 'convenience' and 'installable'
options in lieu of LTDL_CONVENIENCE and LTDL_INSTALL macros. And
also, implement --with-included-ltdl, --with-ltdl-lib and
--with-ltdl-include configure-time options:

* libltdl/m4/ltoptions.m4: Associate existing option settings with
LT_INIT.
(LT_OPTION_DEFINE): Associate options 'nonrecursive', 'recursive',
'subproject', 'installable' and 'convenience' with LTDL_INIT.
(_LT_MANGLE_OPTION, _LT_SET_OPTION, _LT_IF_OPTION)
(_LT_UNLESS_OPTIONS, _LT_SET_OPTIONS): Add MACRO-NAME argument to
support options to named macros instead of hardcoding only LT_INIT
options.
* libltdl/m4/ltdl.m4 (_LTDL_CONVENIENCE): Factor common code from
LTDL_CONVENIENCE and LTDL_INIT([convenience]).
(_LTDL_INSTALLABLE): Factor out common code from LTDL_INSTALLABLE
and LTDL_INIT([installable]).
(_LTDL_SETUP): Renamed from LTDL_INIT.  Support new configure-time
options: --with-included-ltdl, --with-ltdl-lib,
--with-ltdl-include.
(LTDL_CONVENIENCE, LTDL_INSTALLABLE): Adjust.
(LT_WITH_LTDL): Removed.
(LTDL_INIT): Parse caller options.
* libltdl/m4/libtool.m4 (LT_INIT): Declare that this macro must be
expanded before LTDL_INIT, and be sure to parse caller options.
* configure.ac: Call directly into internal _LTDL_SETUP macro.
* libtoolize.m4sh (func_scan_files): Ltdl mode argument moved from
LT_CONFIG_LTDL_DIR to LT_INIT.
* tests/nonrecursive.at, tests/recursive.at: Use new interfaces.
* tests/configure-iface.at: Test it.
* Makefile.am (TESTSUITE_AT): Add configure-iface.at.
* doc/libtool.texi (Distributing libltdl): Document improved.
LTDL_INIT interfaces.
* NEWS: Updated.

13 files changed:
ChangeLog
Makefile.am
NEWS
configure.ac
doc/libtool.texi
libltdl/configure.ac
libltdl/m4/libtool.m4
libltdl/m4/ltdl.m4
libltdl/m4/ltoptions.m4
libtoolize.m4sh
tests/configure-iface.at [new file with mode: 0644]
tests/nonrecursive.at
tests/recursive.at

index f09fc7792fdff79a6d5eb56cd84585c89c216118..33d2091f3ed9aba587a4a0ee53a00fcb3a8ec0fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2008-01-07  Gary V. Vaughan  <gary@gnu.org>
+
+       Move libltdl build mode options from LT_CONFIG_LTDL_DIR to
+       LTDL_INIT.  Accept (optional) new 'convenience' and 'installable'
+       options in lieu of LTDL_CONVENIENCE and LTDL_INSTALL macros. And
+       also, implement --with-included-ltdl, --with-ltdl-lib and
+       --with-ltdl-include configure-time options:
+
+       * libltdl/m4/ltoptions.m4: Associate existing option settings with
+       LT_INIT.
+       (LT_OPTION_DEFINE): Associate options 'nonrecursive', 'recursive',
+       'subproject', 'installable' and 'convenience' with LTDL_INIT.
+       (_LT_MANGLE_OPTION, _LT_SET_OPTION, _LT_IF_OPTION)
+       (_LT_UNLESS_OPTIONS, _LT_SET_OPTIONS): Add MACRO-NAME argument to
+       support options to named macros instead of hardcoding only LT_INIT
+       options.
+       * libltdl/m4/ltdl.m4 (_LTDL_CONVENIENCE): Factor common code from
+       LTDL_CONVENIENCE and LTDL_INIT([convenience]).
+       (_LTDL_INSTALLABLE): Factor out common code from LTDL_INSTALLABLE
+       and LTDL_INIT([installable]).
+       (_LTDL_SETUP): Renamed from LTDL_INIT.  Support new configure-time
+       options: --with-included-ltdl, --with-ltdl-lib,
+       --with-ltdl-include.
+       (LTDL_CONVENIENCE, LTDL_INSTALLABLE): Adjust.
+       (LT_WITH_LTDL): Removed.
+       (LTDL_INIT): Parse caller options.
+       * libltdl/m4/libtool.m4 (LT_INIT): Declare that this macro must be
+       expanded before LTDL_INIT, and be sure to parse caller options.
+       * configure.ac: Call directly into internal _LTDL_SETUP macro.
+       * libtoolize.m4sh (func_scan_files): Ltdl mode argument moved from
+       LT_CONFIG_LTDL_DIR to LT_INIT.
+       * tests/nonrecursive.at, tests/recursive.at: Use new interfaces.
+       * tests/configure-iface.at: Test it.
+       * Makefile.am (TESTSUITE_AT): Add configure-iface.at.
+       * doc/libtool.texi (Distributing libltdl): Document improved.
+       LTDL_INIT interfaces.
+       * NEWS: Updated.
+
 2008-01-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * libltdl/config/ltmain.m4sh (func_mode_link): When creating
index a5f6a53a11e78b4b36789f7fc1a4f31b60a14a1f..b77be0efb6239d95fdaab832ff3fef5eef092622 100644 (file)
@@ -458,6 +458,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/ctor.at \
                  tests/early-libtool.at \
                  tests/deplibs-ident.at \
+                 tests/configure-iface.at \
                  tests/stresstest.at \
                  tests/cmdline_wrap.at
 
diff --git a/NEWS b/NEWS
index ccd697d87781530f25cc9125296566bb52e73f70..87e990142cb717d3d1fbd8fc6d4bc41fdec8aa89 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,7 +20,9 @@ New in 2.1a: 2008-??-??; CVS version 2.1a, Libtool team:
     break if a different shell is used to execute the libtool script
     than the one it was configured for.
   - The macros AC_ENABLE_SHARED, AC_DISABLE_SHARED, AC_ENABLE_STATIC, and
-    AC_DISABLE_STATIC have been un-deprecated after deprecation in 1.9b.
+    AC_DISABLE_STATIC have been un-deprecated after deprecation in
+    1.9b.
+  - The macro LT_WITH_LTDL has been renamed to LTDL_INIT.
   - Fixed a branch-1-5/HEAD regression to only link uninstalled libraries
     statically with `-static'.  In order to compensate for this, there
     is a new link flag `-static-libtool-libs' to provide the previous
@@ -31,6 +33,14 @@ New in 2.1a: 2008-??-??; CVS version 2.1a, Libtool team:
   - Fix installation of libltdl so that it does not need Autoconf and
     Automake installed, in order to be usable in another package.  This
     lifts the restrictions introduced in 1.9b.
+  - Default convenience or installable libltdl builds can optionally
+    be declared using new `convenience' or `installable' options to
+    LTDL_INIT macro (as an alternative to individual LTDL_CONVENIENCE
+    or LTDL_INSTALLABLE invocations).
+  - New configure-time options to allow libltdl parent project builder
+    to choose between installed and shipped libltdl, when invoking
+    LTDL_INIT: --with-included-ltdl, --with-ltdl-include,
+    --with-ltdl-lib.
   - New LT_CONFIG_LTDL_DIR macro to specify a different directory name
     for a convenience libltdl.
   - libtoolize has been completely overhauled.
@@ -40,6 +50,8 @@ New in 2.1a: 2008-??-??; CVS version 2.1a, Libtool team:
     libtoolize.  The new recursive and non-recursive build modes for
     libltdl don't require a subconfigure any more.
     The Libtool package itself builds libltdl nonrecursively.
+  - The 'nonrecursive', 'recursive' and 'subproject' libltdl build
+    modes are given as LTDL_INIT options.
   - 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
index fef579535bbd675e0cbfb9000f88e8510c66a30f..3e2b49713dd560b3c58fd96a32301a31cc2198d1 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to create configure. -*- autoconf -*-
 
-#   Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+#   Copyright (C) 2001, 2004, 2005, 2008 Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2001
 #
 #   This file is part of GNU Libtool.
@@ -181,7 +181,7 @@ AC_PROG_CPP
 ## Libtool initialisation. ##
 ## ----------------------- ##
 LT_INIT([dlopen win32-dll])
-LTDL_INIT([libltdl])
+_LTDL_SETUP
 
 # Enable all the language support we can
 LT_LANG(C++)
index 54fca0a112485dc12d3ef040fbc18d593ce0459f..ec993d0647b8d24810d2b36052242b5e96cae2e4 100644 (file)
@@ -24,7 +24,7 @@
 @ifnottex
 This file documents GNU Libtool @value{VERSION}
 
-Copyright (C) 1996-2007 Free Software Foundation, Inc.
+Copyright (C) 1996-2008 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.2
@@ -51,7 +51,7 @@ identical to this one except for the removal of this paragraph
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2007 Free Software Foundation, Inc.
+Copyright @copyright{} 2008 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the @sc{gnu} Free Documentation License, Version 1.2
@@ -1882,7 +1882,7 @@ LT_PREREQ(@value{VERSION})
 @end example
 @end defmac
 
-@defmac LT_INIT
+@defmac LT_INIT (@var{OPTIONS})
 @defmacx AC_PROG_LIBTOOL
 @defmacx AM_PROG_LIBTOOL
 Add support for the @option{--enable-shared} and @option{--disable-shared}
@@ -1891,7 +1891,7 @@ you define the @file{Makefile} variable @code{top_builddir} in your
 @file{Makefile.in}.  Automake does this automatically, but Autoconf
 users should set it to the relative path to the top of your build
 directory (@file{../..}, for example).}  @code{AC_PROG_LIBTOOL} and
-@code{AM_PROG_LIBTOOL} were names for older versions of this macro;
+@code{AM_PROG_LIBTOOL} are deprecated names for older versions of this macro;
 @code{autoupdate} will upgrade your @file{configure.ac} files.
 
 By default, this macro turns on shared libraries if they are available,
@@ -3867,7 +3867,7 @@ and you should link any program that is intended to dlopen the module with
 dlpreopen the module on platforms that do not support dlopening.  If
 the module depends on any other libraries, make sure you specify them
 either when you link the module or when you link programs that dlopen it.
-If you want to disable @pxref{Versioning} for a specific module
+If you want to disable versioning (@pxref{Versioning}) for a specific module
 you should link it with the @option{-avoid-version} switch.
 Note that libtool modules don't need to have a "lib" prefix.
 However, Automake 1.4 or higher is required to build such modules.
@@ -4359,26 +4359,26 @@ if (lt_dlseterror (LTDL_ERROR_NO_MEMORY) != 0)
 Even though libltdl is installed together with libtool, you may wish
 to include libltdl in the distribution of your package, for the
 convenience of users of your package that don't have libtool or
-libltdl installed.  In this case, you must decide whether to manually
-add the @code{ltdl} objects to your package, or else which flavor of
-libltdl you want to use: a convenience library or an installable
-libtool library.
+libltdl installed, or if you are using features of a very new version
+of libltdl that you don't expect your users to have yet.  In such
+cases, you must decide which flavor of libltdl you want to use: a
+convenience library or an installable libtool library.
 
 The most simplistic way to add @code{libltdl} to your package is to
-copy all the @file{libltdl} source files, to a subdirectory within
+copy all the @file{libltdl} source files to a subdirectory within
 your package and to build and link them along with the rest of your
 sources.  To help you do this, the m4 macros for Autoconf are
 available in @file{ltdl.m4}.  You must ensure that they are available
 in @file{aclocal.m4} before you run Autoconf@footnote{@c
 @c
 We used to recommend adding the contents of @file{ltdl.m4} to
-@file{acinclude.m4}, but with modern Automake (1.8 or newer) and this
-release of libltdl that is not only unnecessary but makes it easy to
-forget to upgrade @file{acinclude.m4} if you move to a different
-release of libltdl.
+@file{acinclude.m4}, but with @command{aclocal} from a modern
+Automake (1.8 or newer) and this release of libltdl that is not only
+unnecessary but makes it easy to forget to upgrade @file{acinclude.m4}
+if you move to a different release of libltdl.
 @c
 }.  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
+@samp{LTDL_INIT} macro to your package's @file{configure.ac} to
 perform the configure time checks required to build the library
 correctly.  Unfortunately, this method has problems if you then try to
 link the package binaries with an installed libltdl, or a library that
@@ -4388,21 +4388,91 @@ 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.
 
-@defmac LT_CONFIG_LTDL_DIR (@var{DIRECTORY}. @var{LTDL-MODE})
+@defmac 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.  Provided that you
-add an appropriate @code{LT_CONFIG_LTDL} call in your
+add an appropriate @code{LT_CONFIG_LTDL_DIR} call in your
 @file{configure.ac} before calling @command{libtoolize}, the
-appropriate @code{libltdl} files will be installed automatically without
-manually specifying the mode to @command{libtoolize} explicitly.
+appropriate @code{libltdl} files will be installed automatically.
+@end defmac
+
+@defmac LTDL_INIT (@var{OPTIONS})
+@defmacx LT_WITH_LTDL
+@defmacx AC_WITH_LTDL
+@code{AC_WITH_LTDL} and @code{LT_WITH_LTDL} are deprecated names for
+older versions of this macro; @command{autoupdate} will update your
+@file{configure.ac} file.
+
+This macro adds the following options to the @command{configure}
+script:
+
+@table @option
+@item --with-ltdl-include @var{INSTALLED-LTDL-HEADER-DIR}
+The @code{LTDL_INIT} macro will look in the standard header file
+locations to find the installed @code{libltdl} headers.  If
+@code{LTDL_INIT} can't find them by itself, the person who builds
+your package can use this option to tell @command{configure} where
+the installed @code{libltdl} headers are.
+
+@item --with-ltdl-lib @var{INSTALLED-LTDL-LIBRARY-DIR}
+Similarly, the person building your package can use this option to
+help @command{configure} find the installed @file{libltdl.la}.
+
+@item --with-included-ltdl
+If there is no installed @code{libltdl}, or in any case if the
+person building your package would rather use the @code{libltdl}
+sources shipped with the package in the subdirectory named by
+@code{LT_CONFIG_LTDL_DIR}, they should pass this option to
+@command{configure}.
+@end table
+
+If the @option{--with-included-ltdl} is not passed at
+configure time, and an installed @code{libltdl} is not
+found@footnote{@c
+@c
+Even if libltdl is installed, @samp{LTDL_INIT} may fail
+to detect it if libltdl depends on symbols provided by libraries
+other than the C library.
+@c
+}, then @command{configure} will exit immediately with an error that
+asks the user to either specify the location of an installed
+@code{libltdl} using the @option{--with-ltdl-include} and
+@option{--with-ltdl-lib} options, or to build with the
+@code{libltdl} sources shipped with the package by passing
+@option{--with-included-ltdl}.
+
+If an installed @code{libltdl} is found, then @code{LIBLTDL} is set to
+the link flags needed to use it, and @code{LTDLINCL} to the
+preprocessor flags needed to find the installed headers.  Note,
+however, that no version checking is performed.  You should manually
+check for the @code{libltdl} features you need in @file{configure.ac}:
+
+@example
+LT_INIT([dlopen])
+LTDL_INIT
+
+# The lt_dladvise_init symbol was added with libtool-2.2
+if test "x$with_included_ltdl" != "xyes"; then
+  save_CFLAGS="$CFLAGS"
+  save_LDFLAGS="$LDFLAGS"
+  CFLAGS="$CFLAGS $LTDLINCL"
+  LDFLAGS="$LDFLAGS $LIBLTDL"
+  AC_CHECK_LIB([ltdl], [lt_dladvise_init],
+               [],
+       [AC_MSG_ERROR(installed libltdl is too old)])
+  LDFLAGS="$save_LDFLAGS"
+  CFLAGS="$save_CFLAGS"
+fi
+@end example
 
-@var{LTDL-MODE} can be either @samp{nonrecursive}, @samp{recursive}, or
-@samp{subproject} depending on how you wish for your project to build
-@code{libltdl}.  In order for @command{libtoolize} to detect
-@var{LTDL-MODE} correctly, if you supply one of these arguments, they
-must be given literally (i.e., macros or shell variables that expand to
-the correct @var{LTDL-MODE} will not work):
+@var{OPTIONS} may include no more than one of the following build
+modes depending on how you want your project to build @code{libltdl}:
+@samp{nonrecursive}, @samp{recursive}, or @samp{subproject}.  In order
+for @command{libtoolize} to detect this option correctly, if you
+supply one of these arguments, they must be given literally (i.e.,
+macros or shell variables that expand to the correct ltdl mode will not
+work).
 
 @table @samp
 @item nonrecursive
@@ -4418,15 +4488,13 @@ need releases of Autoconf and Automake that support
 @example
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_CONFIG_HEADERS([config.h])
-AC_PROG_CC
-AM_PROG_CC_C_O
-LT_CONFIG_LTDL_DIR([libltdl], [nonrecursive])
-LT_WITH_LTDL
+LT_CONFIG_LTDL_DIR([libltdl])
+LTDL_INIT([nonrecursive])
 @end example
 
 @noindent
-You have to use a config header, but it may have a name different than
-@file{config.h}.
+You @emph{have to} use a config header, but it may have a name different
+than @file{config.h}.
 
 Also, add the following near the top of your @file{Makefile.am}:
 
@@ -4448,7 +4516,7 @@ include libltdl/Makefile.inc
 @end example
 
 @noindent
-Unless you don't build any other libraries from this @file{Makefile.am},
+Unless you build no other libraries from this @file{Makefile.am},
 you will also need to change @code{lib_LTLIBRARIES} to assign with
 @samp{+=} so that the @code{libltdl} targets declared in
 @file{Makefile.inc} are not overwritten.
@@ -4462,14 +4530,14 @@ mode, you should add to your @file{configure.ac}:
 @example
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([config.h])
-LT_CONFIG_LTDL_DIR([libltdl], [recursive])
-LT_WITH_LTDL
+LT_CONFIG_LTDL_DIR([libltdl])
+LTDL_INIT([recursive])
 AC_CONFIG_FILES([libltdl/Makefile])
 @end example
 
 @noindent
-You have to use a config header, but it may have a name different than
-@file{config.h}.
+Again, you @emph{have to} use a config header, but it may have a name
+different than @file{config.h} if you like.
 
 Also, add this to your @file{Makefile.am}:
 
@@ -4478,20 +4546,21 @@ SUBDIRS = libltdl
 @end example
 
 @item subproject
-This mode is the default unless you declare otherwise with
-@code{LT_CONFIG_LTDL_DIR}, and is the only mode supported by previous
-releases of libltdl.  If you do not use Autoconf in the parent project,
-then @samp{subproject} mode @code{libltdl} contains all the necessary
-files to configure and build itself -- you just need to arrange for your
-build system to call @file{libltdl/configure} with appropriate options,
-and then run @code{make} in the @code{libltdl} subdirectory.
+This mode is the default unless you explicitly add @code{recursive} or
+@code{nonrecursive} to your @code{LTDL_INIT} options;  @code{subproject}
+is the only mode supported by previous releases of libltdl.  Even if you
+do not use Autoconf in the parent project, then, in @samp{subproject}
+mode, still @code{libltdl} contains all the necessary files to configure
+and build itself -- you just need to arrange for your build system to
+call @file{libltdl/configure} with appropriate options, and then run
+@code{make} in the @code{libltdl} subdirectory.
 
 If you @emph{are} using Autoconf and Automake, then you will need to add
 the following to your @file{configure.ac}:
 
 @example
-LT_CONFIG_LTDL_DIR([libltdl], [subproject])
-LT_WITH_LTDL
+LT_CONFIG_LTDL_DIR([libltdl])
+LTDL_INIT
 @end example
 
 @noindent
@@ -4501,120 +4570,82 @@ and to @file{Makefile.am}:
 SUBDIRS = libltdl
 @end example
 @end table
-@end defmac
 
-@defmac LT_WITH_LTDL
-@defmacx AC_WITH_LTDL
-Add the @option{--with-included-ltdl} option to the @file{configure}
-script.  This option will then allow the person who builds your
-package to choose between linking against an already installed
-@code{libltdl} (@option{--without-included-ltdl}), or the sources
-shipped with the package in the subdirectory named by
-@code{LT_CONFIG_LTDL_DIR} (@option{--with-included-ltdl}).
-
-@code{AC_WITH_LTDL} is a deprecated alias for @code{LT_WITH_LTDL}.
-@end defmac
+Aside from setting the libltdl build mode, there are other keywords
+that you can pass to @code{LTDL_INIT} to modify its behavior when
+@option{--with-included-ltdl} has been given:
 
-@defmac LTDL_INSTALLABLE
-@defmacx AC_LIBLTDL_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.
+@table @samp
+@item convenience
+This is the default unless you explicitly add @code{installable} to
+your @code{LTDL_INIT} options.
 
-By default, this macro will pass options to the @file{configure}
+This keyword will cause options to be passed to the @command{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
+to cause it to be built as a convenience library.  If you're not
 using automake, you will need to define @code{top_build_prefix},
 @code{top_builddir}, and @code{top_srcdir} in your makefile so that
-@code{LIBLTDL} and @code{LTDLINCL} 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
-not using @code{LT_WITH_LTDL}, then you must add a call to
-@code{AC_CONFIG_SUBDIRS(@var{DIRECTORY})} to your @file{configure.ac}.
-
-@code{AC_LIBLTDL_INSTALLABLE} is a deprecated alias for
-@code{LTDL_INSTALLABLE}.
-@end defmac
-
-@defmac LTDL_CONVENIENCE
-@defmacx AC_LIBLTDL_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.
+@code{LIBLTDL} and @code{LTDLINCL} expand correctly.
 
-By default, this macro will pass options to the @file{configure}
+One advantage of the convenience library is that it is not installed,
+so the fact that you use @code{libltdl} will not be apparent to the
+user, and it won't overwrite a pre-installed version of
+@code{libltdl} the system might already have in the installation
+directory.  On the other hand, if you want to upgrade @code{libltdl}
+for any reason (e.g.@: a bugfix) you'll have to recompile your package
+instead of just replacing the shared installed version of
+@code{libltdl}.  However, if your programs or libraries are linked
+with other libraries that use such a pre-installed version of
+@code{libltdl}, you may get linker errors or run-time crashes.
+Another problem is that you cannot link the convenience library into
+more than one libtool library, then link a single program with those
+libraries, because you may get duplicate symbols.  In general you can
+safely use the convenience library in programs that don't depend on
+other libraries that might use @code{libltdl} too.
+
+@item installable
+This keyword will pass options to the @command{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
+to cause it to be built as an installable library.  If you're not
 using automake, you will need to define @code{top_build_prefix},
 @code{top_builddir} and @code{top_srcdir} in your makefile so that
 @code{LIBLTDL} and @code{LTDLINCL} are expanded properly.
 
-@code{AC_LIBLTDL_CONVENIENCE} is a deprecated alias for
-@code{LTDL_CONVENIENCE}.
+Be aware that you could overwrite another @code{libltdl} already
+installed to the same directory if you use this option.
+@end table
 @end defmac
 
-One advantage of the convenience library is that it is not installed,
-so the fact that you use libltdl will not be apparent to the user, and
-it will not overwrite a pre-installed version of libltdl a user might
-have.  On the other hand, if you want to upgrade libltdl for any
-reason (e.g.@: a bugfix) you'll have to recompile your package instead
-of just replacing an installed version of libltdl.  However, if your
-programs or libraries are linked with other libraries that use such a
-pre-installed version of libltdl, you may get linker errors or
-run-time crashes.  Another problem is that you cannot link the
-convenience library into more than one libtool library, then link a
-single program with these libraries, because you may get duplicate
-symbols.  In general you can safely use the convenience library in
-programs that don't depend on other libraries that might use libltdl
-too.  In order to enable this flavor of libltdl, add a call to
-@samp{LTDL_CONVENIENCE} to your @file{configure.ac},
-@emph{before} @samp{LT_INIT}, or use @samp{LT_WITH_LTDL}.
-
-In order to select the installable version of libltdl, you should add a
-call of the macro @samp{LTDL_INSTALLABLE} to your
-@file{configure.ac} @emph{before} @samp{LT_INIT}.  This macro
-will check whether libltdl is already installed and, if not, request the
-libltdl embedded in your package to be built and installed.  Note,
-however, that no version checking is performed.  The user may override
-the test and determine that the libltdl embedded must be installed,
-regardless of the existence of another version, using the configure
-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
-@var{LIBLTDL} 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
-pathname for the convenience version of libltdl and @var{LTDLINCL} will be
-@option{-I} followed by the directory that contains libltdl, starting
-with @samp{$@{top_build_prefix@}} if available, otherwise with
-@samp{$@{top_builddir@}/}, and @samp{$@{top_srcdir@}/} respectively.
-
-If you request an installed version of libltdl and one is
-found@footnote{@c
-@c
-Even if libltdl is installed, @samp{LTDL_INSTALLABLE} may fail
-to detect it, if libltdl depends on symbols provided by libraries
-other than the C library.  In this case, it will needlessly build and
-install libltdl.
-@c
-}, @var{LIBLTDL} will be set to @option{-lltdl} and @var{LTDLINCL} will
-be empty (this is just a blind assumption that @file{ltdl.h} is
-somewhere in the include path if libltdl is in the library path).  If
-an installable version of libltdl must be built, its pathname,
-starting with @samp{$@{top_build_prefix@}} if available, otherwise
-@samp{$@{top_builddir@}/}, will be stored in
-@var{LIBLTDL}, and @var{LTDLINCL} will be set just like in the case of
-convenience library.  So, when you want to link a program with
+Whatever method you use, @samp{LTDL_INIT} will define both the shell
+variable @var{LIBLTDL} to the link flag that you should use to link
+with @code{libltdl}, and the shell variable @var{LTDLINCL} to the
+preprocessor flag that you should use to compile programs that
+include @file{ltdl.h}. So, when you want to link a program with
 libltdl, be it a convenience, installed or installable library, just
-compile with @samp{$(LTDLINCL)} and link it with @samp{$(LIBLTDL)},
-using libtool.
+use @samp{$(LTDLINCL)} for preprocessing and compilation, and
+@samp{$(LIBLTDL)} for linking.
+
+@itemize @bullet
+@item
+If your package is built using an installed version of
+@code{libltdl}, @var{LIBLTDL} will be set to the compiler flags
+needed to link against the installed library, and
+@var{LTDLINCL} will be set to the compiler flags needed to find
+the @code{libltdl} header files.
+
+@item
+If your package is built using the convenience libltdl, @var{LIBLTDL}
+will be the pathname for the convenience version of libltdl
+(starting with @samp{$@{top_builddir@}/}) and @var{LTDLINCL} will be
+@option{-I} followed by the directory that contains @file{ltdl.h}
+(starting with @samp{$@{top_srcdir@}/}).
+
+@item
+If an installable version of the included @code{libltdl} is being
+built, its pathname starting with @samp{$@{top_builddir@}/}, will be
+stored in @var{LIBLTDL}, and @var{LTDLINCL} will be set just like in
+the case of convenience library.
+@end itemize
 
 You should probably also use the @samp{dlopen} option to @code{LT_INIT}
 in your @file{configure.ac}, otherwise libtool will assume no dlopening
@@ -4626,8 +4657,8 @@ all platforms, because the dlopening functions may not be available
 for static linking.
 
 The following example shows you how to embed an installable libltdl in
-your package.  In order to use the convenience variant just replace
-@samp{LTDL_INSTALLABLE} with @samp{LTDL_CONVENIENCE}.  We
+your package.  In order to use the convenience variant, just replace the
+@code{LTDL_INIT} option @samp{installable} with @samp{convenience}.  We
 assume that libltdl was embedded using @samp{libtoolize --ltdl}.
 
 configure.ac:
@@ -4636,14 +4667,11 @@ configure.ac:
 # Name the subdirectory that contains libltdl sources
 LT_CONFIG_LTDL_DIR([libltdl])
 
-## ------------------------------------------ ##
-## Enable building of the installable library ##
-## ------------------------------------------ ##
-LTDL_INSTALLABLE
-
 # Configure libtool with dlopen support if possible
 LT_INIT([dlopen])
-LT_WITH_LTDL
+
+# Enable building of the installable libltdl library
+LTDL_INIT([installable])
 ...
 @end example
 
@@ -4660,6 +4688,18 @@ myprog_DEPENDENCIES = $(LIBLTDL) foo1.la
 ...
 @end example
 
+@defmac LTDL_INSTALLABLE
+@defmacx AC_LIBLTDL_INSTALLABLE
+These macros are deprecated, the @samp{installable} option to
+@code{LTDL_INIT} should be used instead.
+@end defmac
+
+@defmac LTDL_CONVENIENCE
+@defmacx AC_LIBLTDL_CONVENIENCE
+These macros are deprecated, the @samp{convenience} option to
+@code{LTDL_INIT} should be used instead.
+@end defmac
+
 
 @node Trace interface
 @chapter Libtool's trace interface
@@ -5927,7 +5967,7 @@ trick$ chmod +x libtool
 trick$ libtool --version
 ltmain.sh (GNU @@PACKAGE@@@@TIMESTAMP@@) @@VERSION@@
 
-Copyright (C) 2007 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 trick$
index 13617587d31ceae9a913d7653383479c4ddab788..fc50a458af611cbb994bb6cf2ef4874779265e69 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to create configure. -*- autoconf -*-
 #
-#    Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#    Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 #    Written by Gary V. Vaughan, 2004
 #
 #    NOTE: The canonical source of this file is maintained with the
@@ -65,8 +65,7 @@ pkgdatadir='${datadir}'"/${PACKAGE}"
 ## Libtool initialisation. ##
 ## ----------------------- ##
 LT_INIT([dlopen win32-dll])
-LTDL_CONVENIENCE
-LTDL_INIT
+_LTDL_SETUP
 
 
 ## -------- ##
index 43b9082a137701ad496acd4692ae3e6e9780092e..e08a03fa0637ab8b6c6887e6ee67c20cc4b9ab13 100644 (file)
@@ -68,6 +68,7 @@ AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
 AC_REQUIRE([_LT_CHECK_BUILDDIR])dnl
 
 dnl Autoconf doesn't catch unexpanded LT_ macros by default:
@@ -80,7 +81,9 @@ AC_REQUIRE([LTSUGAR_VERSION])dnl
 AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
-m4_require([_LT_SET_OPTIONS], [_LT_SET_OPTIONS([$1])])dnl
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
 
 # This can be used to rebuild libtool when needed
 LIBTOOL_DEPS="$ltmain"
@@ -617,10 +620,10 @@ do
       lt_cl_silent=: ;;
 
     -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try `$[0] --help' for more information.]) ;;
+Try \`$[0] --help' for more information.]) ;;
 
     *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try `$[0] --help for more information.]) ;;
+Try \`$[0] --help' for more information.]) ;;
   esac
   shift
 done
index 3ae4f2ff66908784ddb05b76e0285a41cfabb81f..a034d44df11ff7b09e5f219c3d03a30e41ebe46b 100644 (file)
@@ -1,20 +1,20 @@
 # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
 #
-#   Copyright (C) 1999-2006, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 1999-2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Thomas Tanner, 1999
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 12 LTDL_INIT
+# serial 13 LTDL_INIT
 
 # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
 # ------------------------------------------
 # 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])
+[AC_BEFORE([$0], [LTDL_INIT])
 _$0($*)
 ])# LT_CONFIG_LTDL_DIR
 
@@ -33,16 +33,10 @@ m4_case(_LTDL_DIR,
            [],
        [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])])
 m4_popdef([_ARG_DIR])
-dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
-m4_if(_LTDL_MODE, [],
-       [m4_define([_LTDL_MODE], m4_default([$2], [subproject]))
-       m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])],
-               [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])
 ])# LT_CONFIG_LTDL_DIR
 
 # Initialise:
 m4_define([_LTDL_DIR], [])
-m4_define([_LTDL_MODE], [])
 
 
 # _LT_BUILD_PREFIX
@@ -72,20 +66,35 @@ m4_define([_LT_BUILD_PREFIX],
 # define top_build_prefix, top_builddir, and top_srcdir appropriately
 # in your Makefiles.
 AC_DEFUN([LTDL_CONVENIENCE],
-[AC_BEFORE([$0], [LT_WITH_LTDL])dnl
+[AC_BEFORE([$0], [LTDL_INIT])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
+_$0()
+])# 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], [])
 
-case $enable_ltdl_convenience in
+
+# _LTDL_CONVENIENCE
+# -----------------
+# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]).
+m4_defun([_LTDL_CONVENIENCE],
+[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
-
+esac
 LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la"
 LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}"
 
@@ -95,16 +104,7 @@ AC_SUBST([LTDLINCL])
 # For backwards non-gettext consistent compatibility...
 INCLTDL="$LTDLINCL"
 AC_SUBST([INCLTDL])
-])# 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_CONVENIENCE
 
 
 # LTDL_INSTALLABLE
@@ -120,32 +120,60 @@ dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], [])
 # 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_BEFORE([$0], [LT_WITH_LTDL])dnl
+[AC_BEFORE([$0], [LTDL_INIT])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
+_$0()
+])# LTDL_INSTALLABLE
 
-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])
-   else
-     enable_ltdl_install=yes
-   fi
-  ])
-if test x"$enable_ltdl_install" = x"yes"; then
-  ac_configure_args="$ac_configure_args --enable-ltdl-install"
-  LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la"
-  LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}"
-else
-  ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
-  LIBLTDL="-lltdl"
-  LTDLINCL=
+# 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_INSTALLABLE
+# -----------------
+# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]).
+m4_defun([_LTDL_INSTALLABLE],
+[if test -f $prefix/lib/libltdl.la; then
+  lt_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="-L$prefix/lib $LDFLAGS"
+  AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes])
+  LDFLAGS="$lt_save_LDFLAGS"
+  if test x"${lt_lib_ltdl-no}" = xyes; then
+    if test x"$enable_ltdl_install" != xyes; then
+      # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install
+      AC_MSG_WARN([not overwriting libltdl at $prefix, force with \`--enable-ltdl-install'])
+      enable_ltdl_install=no
+    fi
+  elif test x"$enable_ltdl_install" = xno; then
+    AC_MSG_WARN([libltdl not installed, but installation disabled])
+  fi
 fi
 
+# If configure.ac declared an installable ltdl, and the user didn't override
+# with --disable-ltdl-install, we will install the shipped libltdl.
+case $enable_ltdl_install in
+  no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+      LIBLTDL="-lltdl"
+      LTDLINCL=
+      ;;
+  *)  enable_ltdl_install=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-install"
+      LIBLTDL='${top_builddir}'"${lt_ltdl_dir+/$lt_ltdl_dir}/libltdl.la"
+      LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}"
+      ;;
+esac
+
 AC_SUBST([LIBLTDL])
 AC_SUBST([LTDLINCL])
 
@@ -154,15 +182,6 @@ INCLTDL="$LTDLINCL"
 AC_SUBST([INCLTDL])
 ])# 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_MODE_DISPATCH
 # -------------------
@@ -182,18 +201,22 @@ m4_define([$0], [])
 ])# _LTDL_MODE_DISPATCH
 
 
-# LT_WITH_LTDL
-# ------------
+# LTDL_INIT([OPTIONS])
+# --------------------
 # 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_DEFUN([LTDL_INIT],
+[dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
+m4_if(_LTDL_MODE, [],
+        [m4_define([_LTDL_MODE], m4_default([$2], [subproject]))
+        m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])],
+                [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])
 
 AC_ARG_WITH([included_ltdl],
     [AS_HELP_STRING([--with-included-ltdl],
@@ -215,49 +238,91 @@ if test "x$with_included_ltdl" != xyes; then
   )
 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
+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([ltdl_include],
+    [AS_HELP_STRING([--with-ltdl-include=DIR],
+                    [use the ltdl headers installed in DIR])])
+
+if test -n "$with_ltdl_include"; then
+  if test -f "$with_ltdl_include/ltdl.h"; then :
+  else
+    AC_MSG_ERROR([invalid ltdl include directory: \`$with_ltdl_include'])
+  fi
+else
+  with_ltdl_include=no
 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=
-  INCLTDL=
+AC_ARG_WITH([ltdl_lib],
+    [AS_HELP_STRING([--with-ltdl-lib=DIR],
+                    [use the libltdl.la installed in DIR])])
+
+if test -n "$with_ltdl_lib"; then
+  if test -f "$with_ltdl_lib/libltdl.la"; then :
+  else
+    AC_MSG_ERROR([invalid ltdl library directory: \`$with_ltdl_lib'])
+  fi
+else
+  with_ltdl_lib=no
 fi
 
+case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in
+  ,yes,no,no,)
+       m4_case(m4_default(_LTDL_TYPE, [convenience]),
+           [convenience], [_LTDL_CONVENIENCE],
+           [installable], [_LTDL_INSTALLABLE],
+         [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)])
+       ;;
+  ,no,no,no,)
+       # 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=
+       ;;
+  ,no*,no,*)
+       AC_MSG_ERROR([\`--with-ltdl-include' and \`--with-ltdl-lib' options must be used together])
+       ;;
+  *)   with_included_ltdl=no
+       LIBLTDL="-L$with_ltdl_lib -lltdl"
+       LTDLINCL="-I$with_ltdl_include"
+       ;;
+esac
+INCLTDL="$LTDLINCL"
+
 # Report our decision...
-AC_MSG_CHECKING([whether to use included libltdl])
-AC_MSG_RESULT([$with_included_ltdl])
-
-dnl Be certain that LTDL_INIT is invoked if we are configuring libltdl
-dnl from here:
-m4_if(_LTDL_MODE, [subproject],
-       [_LTDL_MODE_DISPATCH],
-    [AC_PROVIDE_IFELSE([LTDL_INIT],
-           [],
-       [LTDL_INIT
-       AC_DEFUN([LTDL_INIT], [])])])
-])# LT_WITH_LTDL
+AC_MSG_CHECKING([where to find libltdl headers])
+AC_MSG_RESULT([$LTDLINCL])
+AC_MSG_CHECKING([where to find libltdl library])
+AC_MSG_RESULT([$LIBLTDL])
 
-# Old name:
-AU_ALIAS([AC_WITH_LTDL], [LT_WITH_LTDL])
+_LTDL_SETUP
+
+# Only expand once:
+m4_define([LTDL_INIT])
+])# LTDL_INIT
+
+# Old names:
+AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)])
+AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)])
+AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)])
 dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIB_LTDL], [])
 dnl AC_DEFUN([AC_WITH_LTDL], [])
+dnl AC_DEFUN([LT_WITH_LTDL], [])
 
 
-# LTDL_INIT
-# ---------
+# _LTDL_SETUP
+# -----------
 # Perform all the checks necessary for compilation of the ltdl objects
 #  -- 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],
+# other users should call LTDL_INIT instead.
+AC_DEFUN([_LTDL_SETUP],
 [AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([LT_SYS_MODULE_EXT])dnl
 AC_REQUIRE([LT_SYS_MODULE_PATH])dnl
@@ -277,17 +342,7 @@ dnl Don't require this, or it will be expanded earlier than the code
 dnl that sets the variables it relies on:
 _LT_ENABLE_INSTALL
 
-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
-
-dnl _LTDL_MODE specific code must be evaluated at least once:
+dnl _LTDL_MODE specific code must be called at least once:
 _LTDL_MODE_DISPATCH
 
 # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS
@@ -313,12 +368,7 @@ AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 name=ltdl
 LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
 AC_SUBST([LTDLOPEN])
-])# LTDL_INIT
-
-# Old name:
-AU_ALIAS([AC_LIB_LTDL], [LTDL_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIB_LTDL], [])
+])# _LTDL_SETUP
 
 
 # _LT_ENABLE_INSTALL
@@ -327,6 +377,11 @@ m4_define([_LT_ENABLE_INSTALL],
 [AC_ARG_ENABLE([ltdl-install],
     [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])])
 
+case ,${enable_ltdl_install},${enable_ltdl_convenience} in
+  *yes*) ;;
+  *) enable_ltdl_convenience=yes ;;
+esac
+
 AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
 AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
 ])# _LT_ENABLE_INSTALL
index 4a6f18ac0563746744a3f6ae59824c65eb94cf19..ca46819dd599e8ada17d49bf748b4b38f0728eac 100644 (file)
@@ -1,81 +1,83 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 3 ltoptions.m4
+# serial 4 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
 
 
-# _LT_MANGLE_OPTION(NAME)
-# -----------------------
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
 m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
 
 
-# _LT_SET_OPTION(NAME)
-# --------------------
-# Set option NAME, and if there is a matching handler defined,
-# dispatch to it.  Other NAMEs are saved as a flag.
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
 m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1]),
-        _LT_MANGLE_DEFUN([$1]),
-    [m4_warning([Unknown Libtool option `$1'])])[]dnl
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
 ])
 
 
-# _LT_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
 m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1]), [$2], [$3])])
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
 
 
-# _LT_UNLESS_OPTIONS(OPTIONS, IF-NOT-SET)
-# ---------------------------------------
-# Execute IF-NOT-SET if all OPTIONS are not set.
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
 m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
-           [m4_ifdef(_LT_MANGLE_OPTION(_LT_Option),
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+           [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
                      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$2
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
 ])[]dnl
 ])
 
 
-# _LT_SET_OPTIONS(OPTIONS)
-# ------------------------
-# OPTIONS is a space-separated list of Libtool options.
-# If any OPTION has a handler macro declared with LT_OPTION_DEFINE,
-# dispatch to that macro; otherwise complain about the unknown option
-# and exit.
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
 m4_defun([_LT_SET_OPTIONS],
 [# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$1])),
-    [_LT_SET_OPTION(_LT_Option)])
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
 dnl
 dnl Simply set some default values (i.e off) if boolean options were not
 dnl specified:
-_LT_UNLESS_OPTIONS([dlopen], [enable_dlopen=no
+_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
 ])
-_LT_UNLESS_OPTIONS([win32-dll], [enable_win32_dll=no
+_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
 ])
 dnl
 dnl If no reference was made to various pairs of opposing options, then
 dnl we run the default mode handler for the pair.  For example, if neither
 dnl `shared' nor `disable-shared' was passed, we enable building of shared
 dnl archives by default:
-_LT_UNLESS_OPTIONS([shared disable-shared], [_LT_ENABLE_SHARED])
-_LT_UNLESS_OPTIONS([static disable-static], [_LT_ENABLE_STATIC])
-_LT_UNLESS_OPTIONS([pic-only no-pic], [_LT_WITH_PIC])
-_LT_UNLESS_OPTIONS([fast-install disable-fast-install],
+_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
                   [_LT_ENABLE_FAST_INSTALL])
 ])# _LT_SET_OPTIONS
 
@@ -84,24 +86,26 @@ _LT_UNLESS_OPTIONS([fast-install disable-fast-install],
 ## Macros to handle LT_INIT options. ##
 ## --------------------------------- ##
 
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
 m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1]), [[^A-Z0-9_]], [_])])
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
 
 
-# LT_OPTION_DEFINE(NAME, CODE)
-# ----------------------------
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
 m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1]), [$2])[]dnl
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
 ])# LT_OPTION_DEFINE
 
 
 # dlopen
 # ------
-LT_OPTION_DEFINE([dlopen], [enable_dlopen=yes
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
 ])
 
 AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([dlopen])
+[_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `dlopen' option into LT_INIT's first parameter.])
@@ -114,7 +118,7 @@ dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
 # win32-dll
 # ---------
 # Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([win32-dll],
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
@@ -136,7 +140,7 @@ _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
 ])# win32-dll
 
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[_LT_SET_OPTION([win32-dll])
+[_LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `win32-dll' option into LT_INIT's first parameter.])
@@ -179,8 +183,8 @@ AC_ARG_ENABLE([shared],
        [Whether or not to build shared libraries])
 ])# _LT_ENABLE_SHARED
 
-LT_OPTION_DEFINE([shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([disable-shared], [_LT_ENABLE_SHARED([no])])
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
 
 # Old names:
 AC_DEFUN([AC_ENABLE_SHARED],
@@ -188,7 +192,7 @@ AC_DEFUN([AC_ENABLE_SHARED],
 ])
 
 AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([disable-shared])
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
 ])
 
 AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
@@ -233,16 +237,16 @@ AC_ARG_ENABLE([static],
        [Whether or not to build static libraries])
 ])# _LT_ENABLE_STATIC
 
-LT_OPTION_DEFINE([static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([disable-static], [_LT_ENABLE_STATIC([no])])
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
 
 # Old names:
 AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([static])
+[_LT_SET_OPTION([LT_INIT], [static])
 ])
 
 AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([disable-static])
+[_LT_SET_OPTION([LT_INIT], [disable-static])
 ])
 
 AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
@@ -287,19 +291,19 @@ _LT_DECL([fast_install], [enable_fast_install], [0],
         [Whether or not to optimize for fast installation])dnl
 ])# _LT_ENABLE_FAST_INSTALL
 
-LT_OPTION_DEFINE([fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
 
 # Old names:
 AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([fast-install])
+[_LT_SET_OPTION([LT_INIT], [fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `fast-install' option into LT_INIT's first parameter.])
 ])
 
 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([disable-fast-install])
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
 the `disable-fast-install' option into LT_INIT's first parameter.])
@@ -327,12 +331,12 @@ test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC
 
-LT_OPTION_DEFINE([pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([no-pic], [_LT_WITH_PIC([no])])
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
 
 # Old name:
 AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([pic-only])
+[_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
 put the `pic-only' option into LT_INIT's first parameter.])
@@ -340,3 +344,21 @@ put the `pic-only' option into LT_INIT's first parameter.])
 
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+                [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+                [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+                [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+                [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+                [m4_define([_LTDL_TYPE], [convenience])])
index e954e2f1851217f90dd5c1a76440a7b99351ea8f..667abc0dbb103e03e42630068dc59d498795cf78 100644 (file)
@@ -415,21 +415,20 @@ func_scan_files ()
         }
        /_LT_CONFIG_LTDL_DIR(/d
        /LT_CONFIG_LTDL_DIR(/ {
-           s/^.*LT_CONFIG_LTDL_DIR([[   ]*\([^]),]*\)[^,]*/ac_ltdldir=\1%%/
-           s/%%[[,     ]*\([^])]*\).*$/ ac_ltdl_mode=\1%%/
-           s/%%.*$//
+           s,^.*LT_CONFIG_LTDL_DIR([[   ]*\([^])]*\).*$,ac_ltdldir=\1,
            p
        }
        /A[CM]_PROG_LIBTOOL/ {
            s,^.*$,seen_libtool=:,
            p
        }
-       /LT_INIT/            {
+       /LT_INIT/                {
            s,^.*$,seen_libtool=:,
            p
        }
        /LTDL_INIT/          {
-           s,^.*$,seen_ltdl=:,
+           s,^.*LTDL_INIT([[   ]*\([^])]*\).*$,ltdl_options="\1",
+           s,^.*LTDL_INIT[     ]*$,seen_ltdl=:,
            p
        }
        /LT_WITH_LTDL/       {
@@ -456,7 +455,7 @@ func_scan_files ()
 
     # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its
     # arguments were not given in terms of a shell variable!
-    case "$ac_ltdldir$ac_ltdl_mode" in
+    case "$ac_ltdldir" in
       *\$*)
         func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
         ;;
@@ -481,9 +480,26 @@ func_scan_files ()
     # Validate ltdl_mode. #
     # ------------------- #
 
-    test -n "$ac_ltdl_mode" && seen_ltdl=:
+    test -n "$ltdl_options" && seen_ltdl=:
 
-    # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
+    # If $configure_ac contains LTDL_INIT, check that its
+    # arguments were not given in terms of a shell variable!
+    case "$ltdl_options" in
+      *\$*)
+        func_fatal_error "can not handle variables in LTDL_INIT"
+        ;;
+    esac
+
+    # Extract mode name from ltdl_options
+    # FIXME: Diagnose multiple conflicting modes in ltdl_options
+    ac_ltdl_mode=
+    case " $ltdl_options " in
+      *" nonrecursive "*)  ac_ltdl_mode=nonrecursive   ;;
+      *" recursive "*)     ac_ltdl_mode=recursive      ;;
+      *" subproject "*)    ac_ltdl_mode=subproject     ;;
+    esac
+
+    # If neither --ltdl nor an LTDL_INIT mode are specified, default to
     # `subproject'.  If both are specified, they must be the same.  Otherwise,
     # take the one that is given!
     case x$ac_ltdl_mode,x$ltdl_mode in
@@ -492,11 +508,10 @@ func_scan_files ()
       x,x*)    ltdl_mode=$ltdl_mode    ;;
       *)
         test x"$ac_ltdl_mode" = x"$ltdl_mode" || \
-           func_fatal_error "--$ltdl_mode does not match LT_CONFIG_LTDL_DIR($ac_ltdldir, $ac_ltdl_mode)"
+           func_fatal_error "--$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
        ;;
     esac
 
-
     # ---------------- #
     # Validate auxdir. #
     # ---------------- #
diff --git a/tests/configure-iface.at b/tests/configure-iface.at
new file mode 100644 (file)
index 0000000..03ce1b0
--- /dev/null
@@ -0,0 +1,267 @@
+# configure-iface.at -- test ltdl configure interface         -*- Autotest -*-
+#
+#   Copyright (C) 2007 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2007
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_BANNER([configure interface to libltdl.])
+
+# _LTDL_SETUP
+# -----------
+m4_pushdef([_LTDL_SETUP],
+[AT_DATA([main.c],
+[[#include <ltdl.h>
+#include <stdio.h>
+
+typedef int funcp (void);
+
+static int errors = 0;
+
+int
+main (int argc, char **argv)
+{
+  lt_dlhandle handle;
+
+  LTDL_SET_PRELOADED_SYMBOLS();
+
+  if (lt_dlinit () != 0)
+    {
+      fprintf (stderr, "error during initialization: %s\n", lt_dlerror ());
+      return 1;
+    }
+
+  handle = lt_dlopenext ("libmodule");
+  if (!handle)
+    {
+      fprintf (stderr, "can't open libmodule: %s\n", lt_dlerror ());
+      ++errors;
+    }
+
+  {
+    funcp *f = (funcp *) lt_dlsym (handle, "f");
+
+    if (f)
+      {
+        printf ("%d\n", f ());
+      }
+    else
+      {
+        fprintf (stderr, "function `f' not found: %s\n", lt_dlerror ());
+        ++errors;
+      }
+  }
+
+  if (lt_dlexit () != 0)
+    {
+      fprintf (stderr, "error during exit: %s\n", lt_dlerror ());
+      ++errors;
+    }
+
+  return (errors != 0);
+}
+]])
+
+AT_DATA([libmodule.c],
+[[#ifdef __cplusplus
+extern "C" {
+#endif
+int f (void) { return 5150; }
+#ifdef __cplusplus
+}
+#endif
+]])
+
+AT_DATA([expout],
+[[5150
+]])
+])# _LTDL_SETUP
+
+
+## -------------------- ##
+## Installable libltdl. ##
+## -------------------- ##
+
+AT_SETUP([installable libltdl])
+AT_KEYWORDS([libltdl])
+
+_LTDL_SETUP
+
+AT_DATA([configure.ac],
+[[AC_INIT([installable-ltdl-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([libltdl/config])
+AC_CONFIG_MACRO_DIR([libltdl/m4])
+AC_CONFIG_HEADERS([config.h:config.hin])
+LT_CONFIG_LTDL_DIR([libltdl])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AM_PROG_CC_C_O
+LT_INIT([dlopen])
+LTDL_INIT([installable])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[AUTOMAKE_OPTIONS     = 1.7
+
+SUBDIRS                        = libltdl
+
+AM_CFLAGS              = $(LTDLINCL)
+
+lib_LTLIBRARIES                = libmodule.la
+libmodule_la_LDFLAGS   = -module
+
+bin_PROGRAMS           = main
+main_LDFLAGS           = -dlopen libmodule.la
+main_LDADD             = $(LIBLTDL)
+]])
+
+# Install everything!
+prefix=`pwd`/_inst
+
+LT_AT_BOOTSTRAP([--ltdl], [-I libltdl/m4], [], [--add-missing], [],
+        [--with-included-ltdl --prefix=$prefix], [all install])
+
+# TODO: Check that the installed program `main' is linked against our libltdl
+AT_CHECK([test -f $prefix/lib/libltdl.la])
+AT_CHECK([test -f $prefix/include/ltdl.h])
+
+AT_CLEANUP
+
+
+## ------------------------------- ##
+## Link against installed libltdl. ##
+## ------------------------------- ##
+
+AT_SETUP([--with-ltdl-include/lib])
+AT_KEYWORDS([libltdl])
+
+# Install libltdl
+prefix=`pwd`/_inst
+
+LT_AT_LIBTOOLIZE([--copy --ltdl=.])
+LT_AT_CONFIGURE([--enable-ltdl-install --prefix=$prefix])
+LT_AT_MAKE([all install])
+
+# Remove build files
+for x in .* *; do
+  test $x == _inst || rm -rf $x
+done
+
+AT_CHECK([test -f $prefix/lib/libltdl.la])
+AT_CHECK([test -f $prefix/include/ltdl.h])
+
+_LTDL_SETUP
+
+AT_DATA([configure.ac],
+[[AC_INIT([configure-iface-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_MACRO_DIR([_inst/aclocal])
+AC_CONFIG_HEADERS([config.h:config.hin])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AM_PROG_CC_C_O
+LT_INIT([dlopen])
+LTDL_INIT
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[AUTOMAKE_OPTIONS     = 1.7
+
+AM_CFLAGS              = $(LTDLINCL)
+
+lib_LTLIBRARIES                = libmodule.la
+libmodule_la_LDFLAGS   = -module
+
+bin_PROGRAMS           = main
+main_LDFLAGS           = -dlopen libmodule.la
+main_LDADD             = $(LIBLTDL)
+]])
+
+# We don't use 'libtoolize --ltdl', so that we get an error if the test
+# tries to build and link against its own ltdl sources:
+LT_AT_BOOTSTRAP([], [-I _inst/aclocal], [], [--add-missing], [],
+       [--with-ltdl-lib=$prefix/lib --with-ltdl-include=$prefix/include],
+       [all])
+
+## TODO: portable ldd check for correct libltdl
+## Currently, this test doesn't fail if `main' ends up linking against a
+## previously installed system libltdl.
+LT_AT_NOINST_EXEC_CHECK([./main], [-dlopen libmodule.la], [], [expout], [])
+
+AT_CLEANUP
+
+
+## ------------------------------------- ##
+## Link against shipped libltdl sources. ##
+## ------------------------------------- ##
+
+AT_SETUP([--with-included-ltdl])
+AT_KEYWORDS([libltdl])
+
+_LTDL_SETUP
+
+AT_DATA([configure.ac],
+[[AC_INIT([configure-iface-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([libltdl/config])
+AC_CONFIG_MACRO_DIR([libltdl/m4])
+AC_CONFIG_HEADERS([config.h:config.hin])
+LT_CONFIG_LTDL_DIR([libltdl])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AM_PROG_CC_C_O
+LT_INIT([dlopen])
+LTDL_INIT
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[AUTOMAKE_OPTIONS     = 1.7
+
+SUBDIRS                        = libltdl
+
+AM_CFLAGS              = $(LTDLINCL)
+
+lib_LTLIBRARIES                = libmodule.la
+libmodule_la_LDFLAGS   = -module
+
+bin_PROGRAMS           = main
+main_LDFLAGS           = -dlopen libmodule.la
+main_LDADD             = $(LIBLTDL)
+]])
+
+LT_AT_BOOTSTRAP([--ltdl], [-I libltdl/m4], [], [--add-missing], [],
+        [--with-included-ltdl], [all])
+
+# --with-included-ltdl should build a convenience lib by default
+AT_CHECK([test -f libltdl/libltdlc.la])
+
+## TODO: portable ldd check for correct libltdl
+## Currently, this test doesn't fail if `main' ends up linking against a
+## previously installed system libltdl.
+LT_AT_NOINST_EXEC_CHECK([./main], [-dlopen libmodule.la], [], [expout], [])
+
+AT_CLEANUP
+
+dnl Be careful not to let the definition leak into other tests
+m4_popdef([_LTDL_SETUP])
index 6b327bc443efc274f0bb3ab8544f063284c4a16e..39d3ed2e93406d8fe8a753ded06f2129059381fe 100644 (file)
@@ -1,6 +1,6 @@
 # nonrecursive.at -- test nonrecursive Automake Libltdl       -*- Autotest -*-
 #
-#   Copyright (C) 2005 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2005
 #
 #   This file is part of GNU Libtool.
@@ -30,7 +30,7 @@ AT_BANNER([Nonrecursive Automake Libltdl.])
 m4_pushdef([_LTDL_SETUP],
 [AT_DATA([configure.ac],
 [[AC_INIT([subdirectory-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
-LT_CONFIG_LTDL_DIR([ltdl], [nonrecursive])
+LT_CONFIG_LTDL_DIR([ltdl])
 AC_CONFIG_AUX_DIR([ltdl/config])
 AC_CONFIG_MACRO_DIR([ltdl/m4])
 AC_CONFIG_LIBOBJ_DIR([ltdl])
@@ -39,7 +39,7 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
 AC_PROG_CC
 AM_PROG_CC_C_O
 LT_INIT
-LT_WITH_LTDL
+LTDL_INIT([nonrecursive])
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 ]])
index 73671e4b1f1e1c001d20609d05e5ae0f06bb1262..21c2e089ac53cd214372b098a288a0ef5c3b7c8f 100644 (file)
@@ -1,6 +1,6 @@
 # recursive.at -- test recursive Automake libltdl build       -*- Autotest -*-
 #
-#   Copyright (C) 2005 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2005
 #
 #   This file is part of GNU Libtool.
@@ -29,14 +29,14 @@ AT_BANNER([Recursive Automake Libltdl.])
 m4_pushdef([_LTDL_SETUP],
 [AT_DATA([configure.ac],
 [[AC_INIT([subdirectory-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
-LT_CONFIG_LTDL_DIR([ltdl], [recursive])
+LT_CONFIG_LTDL_DIR([ltdl])
 AC_CONFIG_AUX_DIR([ltdl/config])
 AC_CONFIG_MACRO_DIR([ltdl/m4])
 AC_CONFIG_LIBOBJ_DIR([ltdl])
 AC_CONFIG_HEADERS([config.h:config.hin])
 AM_INIT_AUTOMAKE([foreign])
 LT_INIT
-LT_WITH_LTDL
+LTDL_INIT([recursive])
 AC_CONFIG_FILES([Makefile ltdl/Makefile])
 AC_OUTPUT
 ]])
@@ -81,7 +81,7 @@ AT_SETUP([compiling copied libltdl])
 
 _LTDL_SETUP
 
-LT_AT_LIBTOOLIZE([--copy --ltdl])
+LT_AT_LIBTOOLIZE([--debug --copy --ltdl])
 AT_CHECK([if test -f ltdl/configure.ac; then false; fi])
 
 LT_AT_AUTORECONF([--force --verbose --install])