From 8652ce1ff31273c2d20af5853e59a011ba284ad2 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 17 Jan 2008 05:32:42 +0000 Subject: [PATCH] New variable LTDLDEPS for use in output_DEPENDENCIES. * libltdl/m4/ltdl.m4 (_LTDL_CONVENIENCE, _LTDL_INSTALLABLE) (LTDL_INIT): Set and substitute LTDLDEPS according to chosen method. * tests/configure-iface.at (installable libltdl) (--with-ltdl-include/lib, --with-included-ltdl): Test it. * doc/libtool.texi (Distributing libltdl): Document LTDLDEPS. * NEWS: Updated. Dependency bug exposed by Eric Blake in M4, found by Bob Proulx build daemon. --- ChangeLog | 14 ++++++++++ NEWS | 1 + doc/libtool.texi | 57 ++++++++++++++++++++++------------------ libltdl/m4/ltdl.m4 | 7 +++++ tests/configure-iface.at | 11 ++++++++ 5 files changed, 64 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1caf4ce00..2ee274a27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-01-17 Ralf Wildenhues + + New variable LTDLDEPS for use in output_DEPENDENCIES. + + * libltdl/m4/ltdl.m4 (_LTDL_CONVENIENCE, _LTDL_INSTALLABLE) + (LTDL_INIT): Set and substitute LTDLDEPS according to chosen + method. + * tests/configure-iface.at (installable libltdl) + (--with-ltdl-include/lib, --with-included-ltdl): Test it. + * doc/libtool.texi (Distributing libltdl): Document LTDLDEPS. + * NEWS: Updated. + Dependency bug exposed by Eric Blake in M4, found by Bob Proulx + build daemon. + 2008-01-17 Ralf Wildenhues * doc/libtool.texi (Distributing libltdl): Clarify that diff --git a/NEWS b/NEWS index a165c4c86..c6e9acf24 100644 --- a/NEWS +++ b/NEWS @@ -52,6 +52,7 @@ New in 2.1a: 2008-??-??; CVS version 2.1a, Libtool team: The Libtool package itself builds libltdl nonrecursively. - The 'nonrecursive', 'recursive' and 'subproject' libltdl build modes are given as LTDL_INIT options. + - New make variable LTDLDEPS for use in output_DEPENDENCIES. - 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 diff --git a/doc/libtool.texi b/doc/libtool.texi index 15b4139d8..271912dbe 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -4444,10 +4444,11 @@ asks the user to either specify the location of an installed @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}: +the link flags needed to use it, and @code{LTDLINCL} to the preprocessor +flags needed to find the installed headers, and @code{LTDLDEPS} will +be empty. 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]) @@ -4588,7 +4589,7 @@ 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_build_prefix}, @code{top_builddir}, and @code{top_srcdir} in your makefile so that -@code{LIBLTDL} and @code{LTDLINCL} expand correctly. +@code{LIBLTDL}, @code{LTDLDEPS}, and @code{LTDLINCL} expand correctly. 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 @@ -4612,42 +4613,46 @@ 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_build_prefix}, @code{top_builddir} and @code{top_srcdir} in your makefile so that -@code{LIBLTDL} and @code{LTDLINCL} are expanded properly. +@code{LIBLTDL}, @code{LTDLDEPS}, and @code{LTDLINCL} are expanded +properly. Be aware that you could overwrite another @code{libltdl} already installed to the same directory if you use this option. @end table @end defmac -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 -use @samp{$(LTDLINCL)} for preprocessing and compilation, and -@samp{$(LIBLTDL)} for linking. +Whatever method you use, @samp{LTDL_INIT} will define the shell variable +@var{LIBLTDL} to the link flag that you should use to link with +@code{libltdl}, the shell variable @var{LTDLDEPS} to the files that +can be used as a dependency in @file{Makefile} rules, 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 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. +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, @var{LTDLDEPS} will be empty, 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@}/} or @samp{$@{top_build_prefix@}}) -and @var{LTDLINCL} will be @option{-I} followed by the directory that -contains @file{ltdl.h} (starting with @samp{$@{top_srcdir@}/}). +and @var{LTDLDEPS} will be the pathname for the convenience version of +libltdl (starting with @samp{$@{top_builddir@}/} or +@samp{$@{top_build_prefix@}}) 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@}/} or -@samp{$@{top_build_prefix@}}, will be stored in @var{LIBLTDL}, and -@var{LTDLINCL} will be set just like in the case of convenience library. +@samp{$@{top_build_prefix@}}, will be stored in @var{LIBLTDL} and +@var{LTDLDEPS}, 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} @@ -4687,7 +4692,7 @@ AM_CPPFLAGS = $(LTDLINCL) myprog_LDFLAGS = -export-dynamic myprog_LDADD = $(LIBLTDL) -dlopen self -dlopen foo1.la -myprog_DEPENDENCIES = $(LIBLTDL) foo1.la +myprog_DEPENDENCIES = $(LTDLDEPS) foo1.la ... @end example diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4 index 74a571bda..452f2c709 100644 --- a/libltdl/m4/ltdl.m4 +++ b/libltdl/m4/ltdl.m4 @@ -96,9 +96,11 @@ m4_defun([_LTDL_CONVENIENCE], ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... @@ -165,16 +167,19 @@ fi case $enable_ltdl_install in no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" + LTDLDEPS= LTDLINCL= ;; *) enable_ltdl_install=yes ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" ;; esac AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... @@ -282,6 +287,7 @@ case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl + LTDLDEPS= LTDLINCL= ;; ,no*,no,*) @@ -289,6 +295,7 @@ case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= LTDLINCL="-I$with_ltdl_include" ;; esac diff --git a/tests/configure-iface.at b/tests/configure-iface.at index 9ca7b8e40..3fcb0dac7 100644 --- a/tests/configure-iface.at +++ b/tests/configure-iface.at @@ -132,6 +132,7 @@ libmodule_la_LDFLAGS = -module bin_PROGRAMS = main main_LDFLAGS = -dlopen libmodule.la main_LDADD = $(LIBLTDL) +main_DEPENDENCIES = $(LTDLDEPS) ]]) # Install everything! @@ -144,6 +145,10 @@ LT_AT_BOOTSTRAP([--ltdl], [-I libltdl/m4], [], [--add-missing], [], AT_CHECK([test -f $prefix/lib/libltdl.la]) AT_CHECK([test -f $prefix/include/ltdl.h]) +# Check that main is rebuilt if libltdl.la is newer +rm -f libltdl/libltdl.la +AT_CHECK([$MAKE -q main$EXEEXT || exit 1], [1], [ignore], [ignore]) + AT_CLEANUP @@ -196,6 +201,7 @@ libmodule_la_LDFLAGS = -module bin_PROGRAMS = main main_LDFLAGS = -dlopen libmodule.la main_LDADD = $(LIBLTDL) +main_DEPENDENCIES = $(LTDLDEPS) ]]) # We don't use 'libtoolize --ltdl', so that we get an error if the test @@ -249,6 +255,7 @@ libmodule_la_LDFLAGS = -module bin_PROGRAMS = main main_LDFLAGS = -dlopen libmodule.la main_LDADD = $(LIBLTDL) +main_DEPENDENCIES = $(LTDLDEPS) ]]) LT_AT_BOOTSTRAP([--ltdl], [-I libltdl/m4], [], [--add-missing], [], @@ -262,6 +269,10 @@ AT_CHECK([test -f libltdl/libltdlc.la]) ## previously installed system libltdl. LT_AT_NOINST_EXEC_CHECK([./main], [-dlopen libmodule.la], [], [expout], []) +# Check that main is rebuilt if libltdlc.la is newer +rm -f libltdl/libltdlc.la +AT_CHECK([$MAKE -q main$EXEEXT || exit 1], [1], [ignore], [ignore]) + AT_CLEANUP dnl Be careful not to let the definition leak into other tests -- 2.47.3