Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
P
pkg-config
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 56
    • Issues 56
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 7
    • Merge Requests 7
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pkg-config
  • pkg-config
  • Issues
  • #8

Closed
Open
Opened Sep 08, 2017 by Bugzilla Migration User@bugzilla-migration

pkg-config m4 macros treat empty FOO_CFLAGS, FOO_LIBS as unset

Submitted by Simon McVittie

Assigned to pkg..@..op.org

Link to original bug (#102622)

Description

The recommended way to deal with libraries that might not have working .pc metadata appears to be this:

[Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.])

and in the development branch of dbus, we've documented EXPAT_CFLAGS and EXPAT_LIBS as the way to avoid relying on pkg-config metadata for archaic or wrongly-installed versions of Expat (which seems to include SuSE's mingw32-expat, Bug #102613).

However, in a cross-compilation environment with a pre-configured cross-compiler, it's entirely possible that EXPAT_CFLAGS can legitimately be empty: for example, on Bug #102613, <expat.h> appears to already be on the cross-compiler's default search path, so no extra -I flag should be required.

The pkg-config macro ends up doing this:

m4_define([PKG_CONFIG], [if test -n "$$1"; then pkg_cv[]$1="$$1" elif test -n "$PKG_CONFIG"; then ... rely on pkg-config ...

This means that if $1 (in this case EXPAT_CFLAGS) is set, but to an empty value, then we require .pc metadata.

Perhaps the macro should have this pseudo-patch:

m4_define([PKG_CONFIG], -[if test -n "$$1"; then +[if test -n "${$1+set}"; then pkg_cv[]$1="$$1"

so that the decision is really between set vs. unset, rather than between (set && non-empty) vs. (unset || empty).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: pkg-config/pkg-config#8