Re: [xml] The order of arguments when compiling



spam spam spam spam free fr writes:

Thank you for this option.
But if I use it like this :
bin_PROGRAMS = xmlparsefile
xmlparsefile_SOURCES = main.c
xmlparsefile_LDADD = `xml2-config --libs`
xmlparsefile_CFLAGS = -Wall -Wextra `xml2-config --cflags`

I got :
$ autoreconf
src/Makefile.am:3: linker flags such as `--libs`' belong in `xmlparsefile_LDFLAGS
make: *** [Makefile.in] Error 1

Interesting, but I think things will be cleaner if you get the flags in
configure.ac:

LIBXML_LIBS=`xml2-config --libs`
LIBXML_CFLAGS=`xml2-config --cflags`
AC_SUBST([LIBXML_LIBS])
AC_SUBST([LIBXML_CFLAGS])

or you could use the pkg-config macro which lets you check the version
too:

PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.7.8])

Then Makefile.am:

bin_PROGRAMS = xmlparsefile
xmlparsefile_SOURCES = main.c
xmlparsefile_LDADD = $(LIBXML_LIBS)
xmlparsefile_CFLAGS = -Wall -Wextra $(LIBXML_CFLAGS)




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