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 version
$ cups-config --version
copy

SYNOPSIS

cups-config [--api-version] [--build] [--cflags] [--datadir] [--help] [--ldflags] [--libs] [--serverbin] [--serverfiles] [--serverroot] [--sbindir]

PARAMETERS

--api-version
    Prints the CUPS API version supported by the installation.

--build
    Prints the CUPS build number from CUPS_SVERSION.

--cflags
    Prints compiler flags (-I, etc.) for CUPS programs.

--datadir
    Prints the default CUPS data directory.

--help
    Displays usage help and exits.

--ldflags
    Prints linker flags for CUPS programs.

--libs
    Prints library linking flags (-l) for CUPS.

--serverbin
    Prints the CUPS server binaries directory.

--serverfiles
    Prints the CUPS server files directory.

--serverroot
    Prints the CUPS server root directory.

--sbindir
    Prints the CUPS server sbin directory.

DESCRIPTION

cups-config is a utility from the CUPS (Common UNIX Printing System) package that provides essential compiler and linker flags for building applications against the CUPS API. It outputs installation-specific details like include paths, library links, and directory locations, ensuring portable builds without hardcoding values. Developers use it in Makefiles or Autotools via the AC_PROG_CUPS macro from autoconf. For example, --cflags gives compilation flags, --libs provides linking info, and options like --serverroot reveal server paths. This tool simplifies integration with CUPS for printing applications. While reliable on most systems, it's primarily for build-time use and requires a CUPS installation. In contemporary workflows, it remains functional but see caveats for modern alternatives.

CAVEATS

Deprecated since CUPS 2.0 in favor of pkg-config (use pkg-config --cflags cups). Still available but may be removed in future CUPS versions.

EXAMPLE USAGE

cups-config --cflags outputs flags like -I/usr/include/cups.
cups-config --libs gives -lcups. Combine in Makefile: CFLAGS=`cups-config --cflags`.

AUTOTOOLS INTEGRATION

Use AC_PROG_CUPS in configure.ac; it invokes cups-config automatically for CUPS_CFLAGS and CUPS_LIBS.

HISTORY

Developed by Easy Software Products for early CUPS (pre-2000s); evolved with CUPS through Apple acquisition and OpenPrinting. Standard for CUPS builds until 2015 (CUPS 2.0) when pkg-config became preferred for cross-platform compatibility.

SEE ALSO

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

Copied to clipboard