[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conditional modules and libraries.
From: |
Bill Moseley |
Subject: |
Conditional modules and libraries. |
Date: |
Wed, 26 Mar 2003 11:11:59 -0800 (PST) |
Still trying to convert an existing project to automake and libtool. I've
tried to read all the docs (a few times), but it's still not clear for me.
I have a single Makefile.am that builds a binary, a installed library
and a convenience library. (That's the result of most of the code being
in a "src" directory.) I suspect the mutliple libs in one directory is
one of my problems.
I want to add conditional support (e.g. --with-libxml2) to one of the
libraries (a convenience library). I have parser.c and parser.h I also
link in with using liblxm2.
If I was just building a single product I would think it would be correct
to adjust LIBS and CPPFLAGS in my configure script and call
AC_LIBOBJS(parser) which would set LIBOBJS (or in my case LTLIBOBJS). But
in this case I don't want parser.o and -lxml2 linked with other libraries.
My existing configure.in script checks for libxml2 and then sets:
AC_DEFINE(HAVE_LIBXML2,[],[libxml support])
LIBXML2_OBJS="parser.lo"
AC_SUBST(LIBXML2_OBJS)
AC_SUBST(LIBXML2_LIB)
AC_SUBST(LIBXML2_CFLAGS)
The last two are set from xml2-config --libs and --cflags commands.
I use parser.lo because I'm building with libtool, but I'm not sure if
that's the correct method.
So, what I'm trying is:
AM_CPPFLAGS = @LIBXML2_CFLAGS@ @Z_CFLAGS@
[other library and binary built in this Makefile.am snipped]
noinst_LTLIBRARIES = libswishindex.la
libswishindex_la_LIBADD = @LIBXML2_LIB@ @LIBXML2_OBJS@ sw_expat/libswexpat.la
libswishindex_la_DEPENDENCIES = @LIBXML2_OBJS@
##libswishindex_la_LDADD = @LIBXML2_OBJS@
EXTRA_libswishindex_la_SOURCES = parser.c parser.h
libswishindex_la_SOURCES = \
fs.c fs.h \
http.c http.h \
...
Automake is telling me to use LIBADD not LDADD although I was trying to
follow the example on page 43 of the Autoconf book -- I still don't get
the difference between LDADD and LIBADD.
So, basically:
- I want to conditionally add -lxml2 and the CPPFLAGS and the parser.o
module in only that one convenience library. I guess it doesn't hurt
that AM_CPPFLAGS adds the flags to the other library build, but it would
seem best to add them just when building parser.o.
- I do not understand what the DEPENDENCIES entry does, if anything. Is
that needed?
By the way, how can I force the complete rebuiding of just one
(convenience) library without rebuilding everything?
Thanks,
--
Bill Moseley address@hidden
- Conditional modules and libraries.,
Bill Moseley <=