LinuxCommandLibrary

cups-config

Get CUPS compiler/linker flags and options

TLDR

Show where CUPS is currently installed

$ cups-config --serverbin
copy

Show the location of CUPS' configuration directory
$ cups-config --serverroot
copy

Show the location of CUPS' data directory
$ cups-config --datadir
copy

Display help
$ cups-config --help
copy

Display CUPS version
$ cups-config --version
copy

SYNOPSIS

cups-config [OPTION...]

PARAMETERS

--api-version
    Prints the CUPS API version.

--build
    Prints the build platform and architecture.

--cflags
    Prints the C compiler flags needed to compile CUPS applications.

--datadir
    Prints the CUPS data directory path.

--docdir
    Prints the CUPS documentation directory path.

--exec-prefix
    Prints the CUPS executable prefix path.

--help
    Displays a help message and exits.

--install-prefix
    Prints the base CUPS installation prefix path.

--ldflags
    Prints the linker flags needed to link CUPS applications.

--libs
    Prints the libraries required to link against CUPS.

--mandir
    Prints the CUPS manual page directory path.

--serverbin
    Prints the CUPS server binary directory path.

--serverroot
    Prints the CUPS server root directory path (where configuration files reside).

--sitedir
    Prints the CUPS site data directory path.

--statedir
    Prints the CUPS state directory path.

--sysconfdir
    Prints the CUPS system configuration directory path.

--version
    Prints the CUPS version number.

DESCRIPTION

The cups-config command is a utility provided by the CUPS (Common Unix Printing System) project. Its primary purpose is to allow build systems and scripts to query the build configuration, installation paths, and linking information for CUPS libraries and components.

Instead of hardcoding paths, developers use cups-config to dynamically retrieve values such as the installation prefix, server binary directory, data directory, and necessary compiler flags or libraries. This ensures that software depending on CUPS can compile and link correctly, regardless of where CUPS is installed on a particular system. It serves a similar role to pkg-config for other libraries, making software development more robust and portable by automating the discovery of system-specific CUPS details.

CAVEATS

cups-config is primarily intended for developers and build systems, not typical end-users. Its output reflects how CUPS was configured and installed on the specific system, and it will fail if CUPS is not installed or the command is not in the system's PATH.

USAGE IN BUILD SYSTEMS

cups-config is frequently invoked by configure scripts, Makefiles, or modern build tools like CMake. It automates the process of determining necessary header paths (for compilation) and library flags (for linking) for applications that interact with the CUPS printing system. This automation significantly simplifies the compilation and portability of software, eliminating the need for developers to hardcode installation-specific paths.

HISTORY

CUPS (Common Unix Printing System) was originally developed by Easy Software Products, with its first stable release in 1999. It rapidly became the standard printing system for most Linux distributions and macOS. cups-config was introduced as an integral part of the CUPS toolkit. Its purpose was to provide a standardized, portable method for other software (such as printer drivers or CUPS-aware applications) to automatically discover CUPS installation details and compile/link against its libraries, adapting to various system configurations without requiring manual path adjustments. This functionality is analogous to what gtk-config or later pkg-config provided for other development libraries.

SEE ALSO

lp(1), lpr(1), cupsd(8), pkg-config(1)

Copied to clipboard