pkg-config 0.22 does not deal correctly with embedded blanks in directory names

Alan W. Irwin irwin at
Wed Jan 13 21:53:31 PST 2010

My use case is I am testing Linux (Debian Lenny) pkg-config (version 0.22-1)
builds of PLplot examples with embedded blanks in the PLplot installation
prefix in anticipation that PLplot Windows users will tend to use embedded
blanks in directory names.  However, pkg-config is having difficulty
handling those blanks.

Here are the specifics.  The PLplot install prefix is
/home/software/plplot svn/installcmake.  Note the embedded blank.

The corresponding plplotd.pc file (simplified for illustrative purposes) is

libdir=/home/software/plplot svn/installcmake/lib
includedir=/home/software/plplot svn/installcmake/include/plplot
drvdir=/home/software/plplot svn/installcmake/lib/plplot5.9.5/driversd

Name: PLplot 
Description: Scientific plotting library (double precision)
Version: 5.9.5
Libs: -L${libdir} -lplplotd
Cflags: -I${includedir}

I get the following inconsistent results with the above plplotd.pc file.

software at raven> pkg-config --variable=includedir plplotd 
/home/software/plplot svn/installcmake/lib

software at raven> pkg-config --cflags plplotd 
svn/installcmake/include/plplot -I/home/software/plplot

software at raven> pkg-config --variable=libdir plplotd 
/home/software/plplot svn/installcmake/lib

software at raven> pkg-config --libs plplotd
svn/installcmake/lib -L/home/software/plplot -lplplotd

That is, the embedded blank in ${includedir} and ${libdir} is simply passed
back for the --variable case which is the correct result.  However, the
pkg-config parsing of Libs: and Cflags: treats the variable that contains
the embedded blank as two separate blank-delimited items.

Can you recommend some way to work around this limitation of pkg-config?  I
have tried putting both double quotes and single quotes around ${libdir} and
also replaced ${libdir} in the Libs: line with a string with an escaped
embedded blank, i.e.,

Libs: -L/home/software/plplot\ svn/installcmake/lib -lplplotd

but nothing works.

If there is no current way to convince pkg-config to ignore embedded blanks
when parsing Libs: and Cflags: then please consider this post to be a
wishlist bug item to have a way (perhaps using quotes and/or escaped blank
as in the bash command line) to specify a non-parsed blank for Libs: and
Cflags:. This ability is going to be important on the Unix side of things
for those developers who have escaped from Windows but who still tend to use
embedded blanks in directory names. (This is exactly how this PLplot issue
first came up.) This ability is also obviously important on the Windows side
of things as well.

Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (; PLplot scientific plotting software
package (; the libLASi project (; the Loads of
Linux Links project (; and the Linux Brochure Project

Linux-powered Science

More information about the pkg-config mailing list