Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

MakeMakefile#pkg_config

pkg_config(pkg, option=nil)

Returns compile/link information about an installed library in a tuple of [cflags, ldflags, libs], by using the command found first in the following commands:

  1. If --with-{pkg}-config={command} is given via command line option: {command} {option}

  2. {pkg}-config {option}

  3. pkg-config {option} {pkg}

Where {option} is, for instance, --cflags.

The values obtained are appended to +$INCFLAGS+, +$CFLAGS+, +$LDFLAGS+ and +$libs+.

If an option argument is given, the config command is invoked with the option and a stripped output string is returned without modifying any of the global values mentioned above.

See also #link_command #try_const #have_var #try_type also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1