True. A good solution is: -edit configure.ac like this : PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.7.8]) -edit Makefile.am like this : xmlparsefile_LDADD = $(LIBXML_LIBS) xmlparsefile_CFLAGS = -Wall -Wextra $(LIBXML_CFLAGS)
It works fine :) Problem solved. ----- Mail original ----- De: "Csaba Raduly" <rcs...@gmail.com> À: "spam spam spam spam" <spam.spam.spam.s...@free.fr> Cc: xml@gnome.org Envoyé: Lundi 20 Février 2012 15:10:06 Objet: Re: [xml] The order of arguments when compiling On Mon, Feb 20, 2012 at 1:48 PM, <spam.spam.spam.s...@free.fr> wrote: > 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 Note that this is only guaranteed to work on your machine, and only as long as you don't upgrade libxml2. You can't rely on a fixed number of -L options : there may be no -L options at all. On Cygwin, xml2-config --libs outputs -L/usr/lib -lxml2 -lz -liconv -lm but -L/usr/lib is redundant and the next version may decide to omit it altogether. > > 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? No, sorry; I'm not familiar with automake. You may want to file a bug against automake because this error message is incorrect; apparently it didn't recognize the `` construct. 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 _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml