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

Re: Howto Add a Library to the Build?



On Tue, 23 May 2006 10:17:24 +0200
Love Hörnquist Åstrand <lha@kth.se> wrote:

> Michael B Allen <mba2000@ioplex.com> writes:
> > What's the proper way to add a library to the build?
> >
> > For example, let's say I have a library "libplex" in
> > /home/miallen/{include,lib}. It does not use autowhatever
> > so I don't have a .la file. I would like to say ./configure
> > --with-libplex=/home/miallen. Can someone give me a rough overview of
> > what files to look at so I have an idea of what documentation to read.
> 
> If its just a temporary/local-patch thing its easiest to pass them in using
> 
> ./configure CPPFLAGS="-I/home/miallen/include" LIBS="-L/home/miallen/lib -lplex"

Mm, this is exactly what I needed. But then again I assume this
will be passed to every individual compile which is slightly ugly.

> If its a more permanent patch, you probably want to use the heimdal
> extention rk_TEST_PACKAGE. See how its used for openldap in configure.in.
> rk_TEST_PACKAGE will give you automake and autoconf symbols to do ifdef/if
> on (grep for OPENLDAP in the source tree for examples). rk_TEST_PACKAGE
> will also give you LIB_package and INCLUDE_package automake variables.

Just to be completely clear for the next autonewbie, rk_TEST_PACKAGE looks
like a Heimdal specific thing (albeit very handy). You also need to then
add $(INCLUDE_plex) and $(LIB_plex) to the appropriate Makefile.am(s)
and run autoreconf in the top dir (assuming lib. name 'plex' here).

Here are a few other tips for autonewbies:

1) Whenever you edit a Makefile.am you need to rerun autoreconf
   (although I take it -f -i is only necessary if you want to update
   all the otherwise static auto* scripts).
2) If a check is failing, config.log may have more information. For
   example, when I added the rk_TEST_PACKAGE for libplex I initially
   got 'checking for plex ... no'. Turns out the fleeting 'autotest'
   wasn't linking because it was not finding two symbols. I just needed
   to add -ldl -lutil as the extralibs parameter of the rk_TEST_PACKAGE
   macro. Here's the whole macro I used:

 rk_TEST_PACKAGE(plex,[#include <plex/hexdump.h>],-lplex,[-ldl -lutil],, PLEX)

3) Related to above, if you modify any of the checks (cf/*.m4 in heimdal)
   you need to delete the autom4te.cache directory before rerunning
   ./configure --with-plex=/home/miallen. I haven't actually needed to
   do this for Heimdal but I did for another project so I assume it's
   universally true.

Thanks,
Mike