Re: [xml] autoconf/automake and libxml2



On Mon, 2004-02-16 at 03:00, Jesper Mørk wrote:
Hi List

Hi Jesper. :-)


I'm trying to compile a small library using libxml2. I'm trying to use
autoconf and automake to create my makefiles The thing is that when ever
i run make I get a lot of parse errors in the libxml2 library (parser.h
especially). The problem is probably that I don't link to the library
correctly. Here's my configure.ac:


AC_INIT(src/gvideodb/gvideodb.c)
AM_INIT_AUTOMAKE(gvideodb, 'cat ./VERSION')
AM_CONFIG_HEADER(config.h)

PACKAGE=gvideodb

# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL

# Checks for libraries.
AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([
*** GLib 2.0 is required to build GVideoDB; Available at
http://www.gtk.org/.]))
AM_PATH_XML2(2.5.0,,AC_MSG_ERROR([
*** Libxml is required to build GVideoDB; Available at
http://www.libxml.org/.]))
AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([
*** GTK+ 2.0 is required to build GVideoDB; Available at
http://www.gtk.org/.]))

#Langauge Settings
ALL_LINGUAS=""
AM_GLIB_GNU_GETTEXT

GETTEXT_PACKAGE=$PACKAGE
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext
domain])

AM_CFLAGS=(`pkg-config gtk+-2.0 --cflags` `xml2-config --cflags`)

AC_OUTPUT(
Makefile
src/Makefile
src/gvideodb/Makefile
src/libgvdb/Makefile
po/Makefile.in
)dnl

Your use of pkg-config is different from normal. Plus you can use
pkg-config for libxml as well (it has had a .pc files for a couple of
years or so). Typical usage is this...

In configure.ac:

PKG_CHECK_MODULES(GVIDEO, gtk+-2.0 libxml-2.0)
AC_SUBST(GVIDEO_CFLAGS)
AC_SUBST(GVIDEO_LIBS)

then in Makefile.am

INCLUDE = @GVIDEO_CFLAGS@ ...
LDADD = @GVIDEO_LIBS@ ...

This should then work as you expect.

Cheers,
Malcolm




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