Bug 14588

Summary: Inappropriate pkg-config version test
Product: cairo Reporter: Daniel Macks <dmacks>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.5.11   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Daniel Macks 2008-02-20 10:33:29 UTC
cairo's ./configure uses the version of the pkg-config program to determine whether to place Requires.private: vs Requires: in the cairo.pc file. The configure test is for whether the pkg-config is new enough to be able to process the .private directive:

dnl ===========================================================================
dnl Check for recent pkg-config which supports Requires.private

case `$PKG_CONFIG --version` in
[0.?|0.?.?|0.1[0-7]|0.1[0-7].?]) PKGCONFIG_REQUIRES="Requires"; ;;
*) PKGCONFIG_REQUIRES="Requires.private"; ;;
esac

AC_SUBST(PKGCONFIG_REQUIRES)

But what matters is the version of pkg-config that *reads* the file, i.e., the one used when other packages ask to link against cairo, not the one that is present when cairo itself is being compiled. So the test results don't matter and the action taken as the result of the test might not be correct for when that result is used.

pkg-config-0.17 is several years old now, and major distros would almost certainly have newer. Many packages in other projects (example: gnome) assume support for .private. Recent versions of pkg-config also have a "pkg-config" virtual package, so if you really wanted to make sure cairo.pc is processed by a new enough version of pkg-config to understand the contents of that file, you can just add it to the Requires line.
Comment 1 Behdad Esfahbod 2008-02-20 11:21:51 UTC
Thanks Daniel.

(In reply to comment #0)
> cairo's ./configure uses the version of the pkg-config program to determine
> whether to place Requires.private: vs Requires: in the cairo.pc file. The
> configure test is for whether the pkg-config is new enough to be able to
> process the .private directive:
> 
> dnl ===========================================================================
> dnl Check for recent pkg-config which supports Requires.private
> 
> case `$PKG_CONFIG --version` in
> [0.?|0.?.?|0.1[0-7]|0.1[0-7].?]) PKGCONFIG_REQUIRES="Requires"; ;;
> *) PKGCONFIG_REQUIRES="Requires.private"; ;;
> esac
> 
> AC_SUBST(PKGCONFIG_REQUIRES)
> 
> But what matters is the version of pkg-config that *reads* the file, i.e., the
> one used when other packages ask to link against cairo, not the one that is
> present when cairo itself is being compiled. So the test results don't matter
> and the action taken as the result of the test might not be correct for when
> that result is used.

What are configure tests good for if the user will later run against different versions of packages?  I mean, say cairo checks fontconfig version at compile time and it's good, then at run time you try to run it with older fontconfig.  It has all the reasons to fail.  Right?  No difference here.
 
> pkg-config-0.17 is several years old now, and major distros would almost
> certainly have newer. Many packages in other projects (example: gnome) assume
> support for .private. Recent versions of pkg-config also have a "pkg-config"
> virtual package, so if you really wanted to make sure cairo.pc is processed by
> a new enough version of pkg-config to understand the contents of that file, you
> can just add it to the Requires line.

Sure, at some point we'll just remove that.  In the mean time, there's little harm in it, so I won't touch it now.  Probably after 1.6 is out.
Comment 2 GitLab Migration User 2018-08-25 13:31:58 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/52.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.