autoconf
[Top][All Lists]
Advanced

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

ideas on multiple LIBOBJS support


From: Eric Blake
Subject: ideas on multiple LIBOBJS support
Date: Thu, 31 Aug 2006 16:16:28 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I've been trying to come up with ideas to support multiple gnulib libraries in 
a single project (for example, if one wants an LGPL gnulib library linked into 
their own library, and a GPL gnulib library linked into the main app alongside 
their own library).  For background, see

http://lists.gnu.org/archive/html/bug-gnulib/2005-09/msg00030.html

The problem is that AC_REPLACE_FUNCS and friends currently builds its list in a 
single shell variable LIBOBJS, so there is no way to specify that replacement 
functions live in one of multiple subdirectories or are compiled into only one 
of multiple libraries.

Here's my proposed API changes that I think will give gnulib and automake 
enough hooks to support multiple replacement libraries in a single project.

AC_CONFIG_LIBOBJ_DIR(DIRNAME, [VARNAME=LIBOBJS])
# If VARNAME is omitted, default to LIBOBJS.  May be called more than once,
# as long as a different VARNAME is specified each time (although the
# DIRNAME may be the same for multiple VARNAMEs).  Specifies the directory
# where the replacement functions will live, and the shell/AC_SUBST variable
# VARNAME that should track replacement files belonging to the current
# library.  In addition, the AC_SUBST variable LT<VARNAME> will track the
# libtool variant of the same list of replacement files.

AC_LIBSOURCE(FILE, [VARNAME])
# If VARNAME is omitted, default to the VARNAME set by the most recent
# AC_CONFIG_LIBOBJ_DIR (or LIBOBJS if no dir has been specified).  Announce
# that FILE, residing in the directory mapped to VARNAME, may be needed as
# part of a library.

AC_LIBSOURCES(FILELIST, [VARNAME])
# If VARNAME is omitted, default to the VARNAME set by the most recent
# AC_CONFIG_LIBOBJ_DIR (or LIBOBJS if no dir has been specified).  Calls
# AC_LIBSOURCE(file, VARNAME) for each file in the comma-separated FILELIST.

AC_LIBOBJ(FUNCTION, [VARNAME])
# If VARNAME is omitted, default to the VARNAME set by the most recent
# AC_CONFIG_LIBOBJ_DIR (or LIBOBJS if no dir has been specified).  Specify
# that FUNCTION needs replacing by adding function.$ac_objext to the shell
# variable VARNAME, and call AC_LIBSOURCE(function.c, VARNAME).

AC_REPLACE_FUNCS(FUNCTIONLIST, [VARNAME])
# If VARNAME is omitted, default to the VARNAME set by the most recent
# AC_CONFIG_LIBOBJ_DIR (or LIBOBJS if no dir has been specified).  Like
# AC_CHECK_FUNCS, but uses AC_LIBOBJ(function, VARNAME) for each function
# that is missing.


Implementation ideas: define the helper macro _AC_LIBOBJ_VARIABLE which tracks 
the most recent library object, and default it to LIBOBJS.  Instead of using 
LIBOBJS directly in autoconf macros, expand _AC_LIBOBJ_VARIABLE.  Define a set 
of indirect macros _AC_LIBOBJ_DIR(varname) which form an associative lookup 
table.  Then AC_LIBSOURCE can announce the replacement file for a given 
library, including its directory.


I would then envision gnulib-tool adding logic as follows:
in lib1/m4/gnulib-comp.m4, macro lib1_INIT, call AC_CONFIG_LIBOBJ_DIR(lib1, 
lib1_LIBOBJ)
in lib1/Makefile.am, set lib1_<ext>_LIBADD = @<LT>lib1_LIBOBJ@
in lib2/m4/gnulib-comp.m4, macro lib2_INIT, call AC_CONFIG_LIBOBJ_DIR(lib2, 
lib2_LIBOBJ)
in lib2/Makefile.am, set lib2_<ext>_LIBADD = @<LT>lib2_LIBOBJ@

Then all calls to AC_REPLACE_FUNCS within gnulib macros will filter the 
replacement into the correct library, and automake can be taught to trace which 
replacement files live in lib1 vs. lib2 for building the correct dependency 
trees for the two libraries.

Any comments before I try implementing something along these lines?

-- 
Eric Blake






reply via email to

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