Re: [PATCH] Add pkg-config support

"Dan Nicholson" <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
On 7/10/07, Karl Waclawek <[email protected]> wrote:
> Dan Nicholson wrote:
> > Karl, just as an example of why people use pkg-config is that it has
> > very good integration with autoconf. Linking to libexpat while
> > checking the version would be simple:
> >
> > PKG_CHECK_MODULES(EXPAT, expat >= 2.0.1, have_expat=true,
> > have_expat=false)
> >
> > This macro is shipped with pkg-config. The results are stored in
> > EXPAT_LIBS and EXPAT_CFLAGS. That would make linking with expat in
> > non-standard locations trivial.
> >
> > Currently, you have to do something like this (from dbus):
> >
> > AC_CHECK_LIB(expat, XML_ParserCreate_MM,
> >             [ AC_CHECK_HEADERS(expat.h, have_expat=true,
> > have_expat=false) ],
> >             have_expat=false)
> >
> > That works, but it doesn't check versions or store any info about
> > directory prefixes in -I or -L. Anything like that is custom shell and
> > prone to errors.
>
> Any idea if this patch will work on all the environments where Expat
> builds now?

pkg-config works on many platforms. But your case is simple. Since
you're just distributing the .pc file and you don't depend on anything
but C libraries, it's someone else's job to figure out whether it
works on their platform with their package. It should, though. All it
lists is the version, the directories, the necessary CFLAGS, and the
necessary LIBS.

As an example, though, Xorg builds on many platforms, and pkg-config
is a foundation of their build system. To give you an idea of how many
packages make use of pkg-config, this is on my Linux system:

$ ls /usr/lib/pkgconfig/ | wc -l
379

--
Dan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.