[GRASS-dev] [GRASS GIS] #1970: cairo config on Mac can't find pkg-config

#1970: cairo config on Mac can't find pkg-config
------------------------------+---------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Packaging | Version: svn-trunk
Keywords: configure, cairo | Platform: MacOSX
      Cpu: All |
------------------------------+---------------------------------------------
Hi,

on Mac OSX the ./configure script comes up with a few errors, and possibly
doesn't enable all rendering options that could be enabled because it
tries to use the pkg-config program.

an example from Michael:
{{{
./configure [...] --with-cairo --with-cairo-includes="/Library/Frameworks\
/cairo.framework/unix/include/cairo /Library/Frameworks/cairo.framework\
/unix/include" --with-cairo-libs=/Library/Frameworks/cairo.framework\
/unix/lib --with-cairo-ldflags="-lcairo" [...]
...
checking whether to use Cairo... yes
./configure: line 11623: pkg-config: command not found
./configure: line 11623: pkg-config: command not found
./configure: line 11623: pkg-config: command not found
./configure: line 11623: pkg-config: command not found
./configure: line 11623: pkg-config: command not found
./configure: line 11623: pkg-config: command not found
./configure: line 11630: pkg-config: command not found
checking for location of cairo includes...
/Library/Frameworks/cairo.framework/unix/include/cairo
/Library/Frameworks/cairo.framework/unix/include
checking for cairo.h... yes
./configure: line 11700: pkg-config: command not found
checking for location of cairo library...
/Library/Frameworks/cairo.framework/unix/lib
...
}}}

config.log is available upon request, but I think the above says it all.

the relevant part of configure.in is:
{{{
# Enable Cairo display driver option

LOC_CHECK_USE(cairo,Cairo,USE_CAIRO)

CAIROINC=
CAIROLIB=

if test -n "$USE_CAIRO"; then

cairo="cairo"
pkgs="cairo-ft cairo-fc cairo-pdf cairo-ps cairo-svg fontconfig"
if test -n "$USE_X11"; then
         pkgs="$pkgs cairo-xlib cairo-xlib-xrender"
fi
for pkg in $pkgs ; do
     if pkg-config --exists $pkg ; then
         cairo="$cairo $pkg"
     fi
done

# With Cairo includes directory
#FIXME: somehow quote dirs with spaces in $cairo ?
CAIROINC=`pkg-config --cflags $cairo`

LOC_CHECK_INC_PATH(cairo,cairo,CAIROINC)

LOC_CHECK_INCLUDES(cairo.h,Cairo,$CAIROINC)

# With Cairo library directory

CAIROLIB=`pkg-config --libs $cairo`

LOC_CHECK_LIB_PATH(cairo,cairo,CAIROLIB)
LOC_CHECK_LDFLAGS(cairo,cairo,CAIROLIB)

LOC_CHECK_FUNC(cairo_create,$CAIROLIB,[:])
LOC_CHECK_FUNC(cairo_xlib_surface_create_with_xrender_format,$CAIROLIB,
[CAIRO_HAS_XRENDER=1],[CAIRO_HAS_XRENDER=])
AC_SUBST(CAIRO_HAS_XRENDER)
LOC_CHECK_FUNC(cairo_xlib_surface_get_xrender_format,$CAIROLIB,
[CAIRO_HAS_XRENDER_SURFACE=1],[CAIRO_HAS_XRENDER_SURFACE=])
AC_SUBST(CAIRO_HAS_XRENDER_SURFACE)

CAIROLIB="$CAIROLIB $CAIROLDFLAGS"

fi # $USE_CAIRO
}}}

i.e. it assumes that pkg-config will always be there.

Platform.make ends up with:
{{{
#cairo
CAIROINC =
-I/Library/Frameworks/cairo.framework/unix/include/cairo
-I/Library/Frameworks/cairo.framework/unix/include
CAIROLIB =
-L/Library/Frameworks/cairo.framework/unix/lib -lcairo
USE_CAIRO = 1
CAIRO_HAS_XRENDER =
CAIRO_HAS_XRENDER_SURFACE =
}}}

?,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1970&gt;
GRASS GIS <http://grass.osgeo.org>

#1970: cairo config on Mac can't find pkg-config
------------------------------+---------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Packaging | Version: svn-trunk
Keywords: configure, cairo | Platform: MacOSX
      Cpu: All |
------------------------------+---------------------------------------------

Comment(by glynn):

Replying to [ticket:1970 hamish]:

> on Mac OSX the ./configure script comes up with a few errors, and
possibly doesn't enable all rendering options that could be enabled
because it tries to use the pkg-config program.

AFAICT, there isn't any problem (other than the noise). If you don't have
pkg-config, then you need to specify --with-cairo-includes, --with-cairo-
libs and --with-cairo-ldflags manually, but the failed attempts to run
pkg-config shouldn't affect anything.

XRender support is only meaningful for an X11 version of cairo (and AFAIK,
there hasn't been any movement on having the wx GUI make use of it even
when it's available).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1970#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>