@item --ltdl [@var{TARGET-DIRECTORY-NAME}]
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:
-@code{LT_WITH_LTDL}; @code{LTDL_CONVENIENCE};
-@code{LTDL_INSTALLABLE} (@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
}. Having made the macros available, you must add a call to the
@samp{LT_WITH_LTDL} macro to your package's @file{configure.ac} to
perform the configure time checks required to build the library
-correctly. This method has problems if you then try to link the
-package binaries with an installed libltdl, or a library that depends
-on libltdl: you will have problems with duplicate symbol definitions.
+correctly. Unfortunately, this method has problems if you then try to
+link the package binaries with an installed libltdl, or a library that
+depends on libltdl, because of the duplicate symbol definitions. For
+example, ultimately linking against two different versions of libltdl,
+or against both a local convenience library and an installed libltdl
+is bad. Ensuring that only one copy of the libltdl sources are linked
+into any program is left as an exercise for the reader.
+
+@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.
+@end defmac
-@defmac LT_WITH_LTDL (@var{DIRECTORY})
+@defmac 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
-@command{libtoolize --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
-@code{libltdl} source files.
+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}).
@end defmac
-@defmac LTDL_INSTALLABLE (@var{DIRECTORY})
+@defmac 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
-@code{top_srcdir} 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
+@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
@code{AC_CONFIG_SUBDIRS(@var{DIRECTORY})} to your @file{configure.ac}.
@end defmac
-@defmac LTDL_CONVENIENCE (@var{DIRECTORY})
+@defmac 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
+@code{top_srcdir} in your makefile so that @code{LIBLTDL} and
+@code{LTDLINCL} are expanded properly.
@end defmac
One advantage of the convenience library is that it is not installed,
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
+@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
configure.ac:
@example
...
+# Name the subdirectory that contains libltdl sources
+LT_CONFIG_LTDL_DIR([libltdl])
+
## ------------------------------------------ ##
## Enable building of the installable library ##
## ------------------------------------------ ##
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 8 LTDL_INIT
+# serial 9 LTDL_INIT
-# LT_WITH_LTDL([DIRECTORY])
-# -------------------------
-# Clients of libltdl can use this macro to allow the installer to
-# choose between a shipped copy of the ltdl sources or a preinstalled
-# version of the library.
-AC_DEFUN([LT_WITH_LTDL],
-[AC_ARG_WITH([included_ltdl],
- [AS_HELP_STRING([--with-included-ltdl],
- [use the GNU ltdl sources included here])])
-
-if test "x$with_included_ltdl" != xyes; then
- # We are not being forced to use the included libltdl sources, so
- # decide whether there is a useful installed version we can use.
- AC_CHECK_HEADER([ltdl.h],
- [AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
- [with_included_ltdl=no],
- [with_included_ltdl=yes])],
-
- [],
- [AC_INCLUDES_DEFAULT]
- )
-fi
-
-if test "x$enable_ltdl_install" != xyes; then
- # If the user did not specify an installable libltdl, then default
- # to a convenience lib.
- LTDL_CONVENIENCE(m4_default([$1], [libltdl]))
-fi
-
-if test "x$with_included_ltdl" = xno; then
- # If the included ltdl is not to be used. then Use the
- # preinstalled libltdl we found.
- AC_DEFINE([HAVE_LTDL], [1],
- [Define this if a modern libltdl is already installed])
- LIBLTDL=-lltdl
-fi
-
-# Report our decision...
-AC_MSG_CHECKING([whether to use included libltdl])
-AC_MSG_RESULT([$with_included_ltdl])
-
-AC_CONFIG_SUBDIRS(m4_default([$1], [libltdl]))
-])# LT_WITH_LTDL
-
-# 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])
+# LT_CONFIG_LTDL_DIR(DIRECTORY)
# -----------------------------
+# DIRECTORY contains the libltdl sources. It is okay to call this
+# function multiple times, as long as the same DIRECTORY is always given.
+AC_DEFUN([LT_CONFIG_LTDL_DIR],
+[AC_BEFORE([$0], [LT_WITH_LTDL])
+_$0($*)
+])# LT_CONFIG_LTDL_DIR
+
+# We break this out into a separate macro, so that we can call it safely
+# internally without being caught accidentally by the sed scan in libtoolize.
+m4_defun([_LT_CONFIG_LTDL_DIR],
+[m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$]))
+m4_case(_LTDL_DIR,
+ [], [m4_define([_LTDL_DIR], _ARG_DIR)
+ _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])],
+ [m4_if(_ARG_DIR, _LTDL_DIR,
+ [],
+ [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])])
+m4_popdef([_ARG_DIR])
+])
+
+# Initialise:
+m4_define([_LTDL_DIR], [])
+
+
+# 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])
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])
])
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"
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_MSG_CHECKING([for lt_dlinterface_register in ltdl.h])
+ lt_dlinterface_register_found=no
+ AC_CHECK_HEADER([ltdl.h],
+ [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
+ [with_included_ltdl=no],
+ [with_included_ltdl=yes])],
+
+ [],
+ [AC_INCLUDES_DEFAULT]
+ )
+ test "x$with_included_ltdl" = xno && lt_dlinterface_register_found=yes
+ AC_MSG_RESULT([$lt_dlinterface_register_found])
+fi
+
+if test "x$enable_ltdl_install" != xyes; then
+ # If the user did not specify an installable libltdl, then default
+ # to a convenience lib.
+ LTDL_CONVENIENCE
+fi
+
+if test "x$with_included_ltdl" = xno; then
+ # If the included ltdl is not to be used, then use the
+ # preinstalled libltdl we found.
+ AC_DEFINE([HAVE_LTDL], [1],
+ [Define this if a modern libltdl is already installed])
+ LIBLTDL=-lltdl
+ LTDLINCL=
+fi
+
+# Report our decision...
+AC_MSG_CHECKING([whether to use included libltdl])
+AC_MSG_RESULT([$with_included_ltdl])
+
+AC_CONFIG_SUBDIRS(_LTDL_DIR)
+
+dnl Be certain that LTDL_INIT is invoked:
+AC_PROVIDE_IFELSE([LTDL_INIT],
+ [],
+ [LTDL_INIT
+ AC_DEFUN([LTDL_INIT], [])])
+])# LT_WITH_LTDL
+
+# Old name:
+AU_ALIAS([AC_WITH_LTDL], [LT_WITH_LTDL])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_WITH_LTDL], [])
+
+
+# LTDL_INIT
+# ---------
# Perform all the checks necessary for compilation of the ltdl objects
-# -- including compiler checks and header checks.
+# -- including compiler checks and header checks. This is a public
+# interface mainly for the benefit of libltdl's own configure.ac, most
+# other users should call LT_WITH_LTDL instead.
AC_DEFUN([LTDL_INIT],
-[m4_ifval([$1], [m4_divert_push([DEFAULTS])dnl
-# libltdl will be built in the named DIRECTORY, relative to $top_builddir.
-lt_ltdl_dir='$1'
-m4_divert_pop([DEFAULTS])])dnl
-
-AC_REQUIRE([AC_PROG_CC])dnl
+[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_HEADER_DIRENT])dnl
m4_require([_LT_ENABLE_INSTALL])dnl
m4_require([_LT_CHECK_DLPREOPEN])dnl
+dnl Although deprecated and no longer documented, alpha releases of
+dnl libtool used to define an LTDL_INIT to take a DIRECTORY orgument.
+dnl If LT_CONFIG_LTDL_DIR was called already, but LTDL_INIT was given a
+dnl DIRECTORY argument, check it is the same as previous invocations. If
+dnl it still hasn't been called, then do it now, defaulting to `libltdl'
+dnl if no DIRECTORY argument was passed.
+m4_provide_if([_LT_CONFIG_LTDL_DIR],
+ [m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])],
+ [_LT_CONFIG_LTDL_DIR(m4_default([$1], [libltdl]))])dnl
+
# In order that ltdl.c can compile, run AC_CONFIG_HEADERS for the user
# if they did not call it themself. This is so that ltdl.h can pick up
# the parent projects config.h file, The first file in AC_CONFIG_HEADERS
LT_DLLOADERS=
AC_SUBST([LT_DLLOADERS])
-test "X${lt_ltdl_dir-.}" != X. &&
- lt_ltdl_dir=`echo "$lt_ltdl_dir/" | sed 's,/*$,/,'`
-
AC_LANG_PUSH([C])
LIBADD_DLOPEN=
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DLOPEN="-ldl" libltdl_cv_lib_dl_dlopen="yes"
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"],
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
libltdl_cv_func_dlopen="yes"
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"],
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"],
[AC_CHECK_LIB([svld], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes"
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dlopen.la"])])])
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dlopen.la"])])])
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes
then
lt_save_LIBS="$LIBS"
AC_CHECK_FUNC([shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}shl_load.la"],
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}shl_load.la"],
[AC_CHECK_LIB([dld], [shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}shl_load.la"
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}shl_load.la"
LIBADD_SHL_LOAD="-ldld"])])
AC_SUBST([LIBADD_SHL_LOAD])
AC_CHECK_FUNC([_dyld_func_lookup],
[AC_DEFINE([HAVE_DYLD], [1],
[Define if you have the _dyld_func_lookup function.])
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dyld.la"])
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dyld.la"])
;;
beos*)
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}load_add_on.la"
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}load_add_on.la"
;;
cygwin* | mingw* | os2* | pw32*)
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}loadlibrary.la"
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}loadlibrary.la"
;;
esac
AC_CHECK_LIB([dld], [dld_link],
[AC_DEFINE([HAVE_DLD], [1],
[Define if you have the GNU dld library.])
- LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir}dld_link.la"])
+ LT_DLLOADERS="$LT_DLLOADERS ${lt_ltdl_dir+$lt_ltdl_dir/}dld_link.la"])
AC_SUBST([LIBADD_DLD_LINK])
m4_pattern_allow([^LT_DLPREOPEN$])
# -n, --dry-run print commands rather than running them
# -f, --force replace existing files
# -i, --install copy missing auxiliary files
-# --ltdl[=DIR] install libltdl in a subdirectory [default: libltdl]
+# --ltdl[=DIR] install libltdl sources [default: libltdl]
# -q, --quiet work silently
# -v, --verbose verbosely report processing
# --version print version information and exit
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
--install|-i) opt_install=: ;;
- --ltdl) ltdldir=libltdl
+ --ltdl) opt_ltdl=:
if test "$#" -gt 0; then
case $1 in
- -*) ;;
- *) ltdldir="$1"; shift ;;
+ -*) ;;
+ *) ltdldir=`$ECHO "X$1" | $Xsed -e 's,/*$,,'`
+ shift
+ ;;
esac
fi
;;
shift
;;
+ # Separate optargs to short options:
+ #-X*)
+ # arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
+ # opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
+ # set dummy "$opt" "$arg" ${1+"$@"}
+ # shift
+ # ;;
+
# Separate non-argument short options:
- -c*|-i*|-f*|-n*|-q*|-v*)
+ -c*|-f*|-i*|-n*|-q*|-v*)
rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
set dummy "$opt" "-$rest" ${1+"$@"}
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
}
/AC_CONFIG_MACRO_DIR(/ {
s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,macrodir=\1,; p;
};
+ /_LT_CONFIG_LTDL_DIR(/d;
+ /LT_CONFIG_LTDL_DIR(/ {
+ s,^.*LT_CONFIG_LTDL_DIR([[[ ]*\([^])]]*\).*$,ac_ltdldir=\1,; p;
+ };
/A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
/LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
/LTDL_INIT/ { s,^.*$,seen_ltdl=:,; p; };
eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
+ # ----------------- #
+ # Validate ltdldir. #
+ # ----------------- #
+
+ ac_ltdldir=`$ECHO "X$ac_ltdldir" | $Xsed -e 's,/*$,,'`
+
+ # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
+ # not given in terms of a shell variable!
+ case "$ac_ltdldir" in
+ *\$*)
+ func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
+ ;;
+ esac
+
+ # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
+ # `libltdl'. If both are specified, they must be the same. Otherwise,
+ # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
+ # we suggest adding it later in this code.)
+ case x$ac_ltdldir,x$ltdldir in
+ x,x) ltdldir=libltdl ;;
+ x*,x) ltdldir=$ac_ltdldir ;;
+ x,x*) ltdldir=$ltdldir ;;
+ *)
+ test x"$ac_ltdldir" = x"$ltdldir" || \
+ func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)"
+ ;;
+ esac
+
+
# ---------------- #
# Validate auxdir. #
# ---------------- #
# 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,
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