On 02/21/2012 09:06 AM, [email protected] wrote:
> Hello,
> 
> In my Makefile.am I try this:
> xmlparsefile_LDFLAGS = `pkg-config libxml-2.0 --libs-only-L`
> xmlparsefile_LDADD = `pkg-config libxml-2.0 --libs-only-l`
> Then it is refused:
> $ autoreconf
> src/Makefile.am:6: linker flags such as `--libs-only-l`' belong in 
> `xmlparsefile_LDFLAGS
> autoreconf: automake failed with exit status: 1
>
This is happening because automake peeks into the $(xmlparsefile_LDADD) 
contents,
and since there it sees what seems like an option to it ("--libs-only-l`"), it
warns that this is not an allowed usage.  Automake is not smart enough to
recognize the command substitution in $(xmlparsefile_LDADD).  And this is not
likely to change.

> So there is an other solution:
> -edit the configure.ac file:
> PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.7.8])
> -edit the Makefile.am file:
> xmlparsefile_LDADD = $(LIBXML_LIBS)
> xmlparsefile_CFLAGS = -Wall -Wextra $(LIBXML_CFLAGS)
> An now, it is accepted.
> 
In this case, automake realizes that the $(xmlparsefile_LDADD) contents will be
provided at configure time -- so it cannot check them, and just trust the
configure script will provide them correctly.

BTW, note that even if automake wouldn't complain in your first example, the
second solution (with PKG_CHECK_MODULES) would be the correct one: requirements
should be checked at configure time, not at make time.

HTH,
 Stefano

Reply via email to