Re: [xml] The order of arguments when compiling



Easy to get the -L options and -l options separatly with a good old 'cut' :
$ xml2-config --libs | cut -d " " -f 1
-L/home/spierre/software/libxml2-2.7.8/lib
$ xml2-config --libs | cut -d " " -f 2-
-lxml2 -lz -lm

My new Makefile.am:
bin_PROGRAMS = xmlparsefile
xmlparsefile_SOURCES = main.c
xmlparsefile_LDFLAGS = `xml2-config --libs | cut -d " " -f 1`
xmlparsefile_LDADD = `xml2-config --libs | cut -d " " -f 2-`
xmlparsefile_CFLAGS = -Wall -Wextra `xml2-config --cflags

But error :
$ autoreconf
src/Makefile.am:4: linker flags such as `--libs' belong in `xmlparsefile_LDFLAGS
autoreconf: automake failed with exit status: 1

Do you see how to avoid this error?

----- Mail original -----
De: "Csaba Raduly" <rcsaba gmail com>
Ã: "spam spam spam spam" <spam spam spam spam free fr>
Cc: xml gnome org
EnvoyÃ: Lundi 20 FÃvrier 2012 10:05:45
Objet: Re: [xml] The order of arguments when compiling

On Mon, Feb 20, 2012 at 9:06 AM,  <spam spam spam spam free fr> wrote:
Hum... I prefer a solution which works if we type :
$ ./configure
$ make
$ make install

If I request my users to do :
$ ./configure
$ make LIBS=`xml2-config --libs`
$ make install
I think they will not be happy.

The best thing is to edit my Makefile.am correctly.

Do you know what is incorrect in my Makefile.am?

I think that  `xml2-config --libs` , which outputs -L options (that go
into LDFLAGS) and -l options (that go into LDADD) together, does not
play well with automake that expects them separately.
If xml2-config had separate --ldflags and --libs options, it would
have been easier for you. Unfortunately, it doesn't.

Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds



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