sdl2-config(1)

πŸ“¦
version 2.32.70 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ sdl2-config β€” the little script that knows where ur SDL is πŸ’…

ok so bestie, welcome to the sdl2-config manual page β€” from the General Commands Manual section, no big deal, she's iconic.


🌸 NAME 🌸

sdl2-config β€” the script that tells u literally everything about the version of SDL that's installed on ur machine 🫢


🌈 SYNOPSIS 🌈

sdl2-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version]
[--cflags] [--libs] [--static-libs]

πŸ’– DESCRIPTION πŸ’–

okay so sdl2-config is the tool u use to configure and figure out the compiler and linker flags that u need to compile and link programs, libraries and plugins that use SDL. It's also used internally by the m4 macros that ship with SDL, so she's lowkey the backbone of the whole thing. main character energy fr fr πŸ‘‘

BUT β€” and this is the important part, no cap β€” if ur writing new code, consider using pkg-config(1) or pkgconf(1) instead of sdl2-config. To support cross-compiling, if the environment variable PKG_CONFIG is set, its value should be used instead of the literal name pkg-config or pkgconf. iykyk 🌟

  • In Autotools build systems, the preferred way to detect SDL is with the PKG_CHECK_MODULES([SDL], [sdl2]) macro invocation from pkg.m4(7).
  • In Meson build systems, the preferred way to detect SDL is with Meson's usual dependency('sdl2') function call.
  • In CMake build systems, the preferred way to detect SDL is to use find_package(SDL2 CONFIG) and optionally find_package(SDL2 CONFIG COMPONENTS SDL2main), then link to SDL2::SDL2 and optionally SDL2::SDL2main.

✨ OPTIONS ✨

  • --cflags β€” prints the compiler flags that are necessary to compile a program or library that uses SDL. πŸ’–

the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --cflags sdl2.

  • --exec-prefix[=DIR] β€” if DIR is not specified, print the exec prefix of the current SDL installation. the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --variable=exec_prefix sdl2.

if DIR is specified, use it instead of the installation exec prefix that SDL was built with when computing the output for the --cflags, --libs and --static-libs options. this option must be specified before any of the options --cflags, --libs and --static-libs. the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --define-variable=exec_prefix=DIR [--cflags|--libs|...] sdl2.

  • --libs β€” prints the linker flags that are necessary to link a program that uses SDL. πŸ”₯

the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --libs sdl2.

  • --static-libs β€” prints the linker flags that are necessary to statically link a program that uses SDL. 🧚

the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --static --libs sdl2.

  • --prefix[=DIR] β€” if DIR is not specified, print the prefix of the current SDL installation. the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --variable=prefix sdl2.

if DIR is specified, use it instead of the installation prefix that SDL was built with when computing the output for the --cflags, --libs and --static-libs options. this option is also used for the exec prefix if --exec-prefix was not specified. this option must be specified before any of the options --cflags, --libs and --static-libs. the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --define-variable=prefix=DIR [--cflags|--libs|...] sdl2.

  • --version β€” prints the currently installed version of SDL on standard output. ⭐

the pkg-config equivalent is ${PKG_CONFIG:-pkg-config} --modversion sdl2.

bestie pls remember: --prefix and --exec-prefix have GOT to come before --cflags, --libs and --static-libs, or they just won't do the thing. order matters, periodt. πŸ’…

πŸŽ€ EXAMPLES πŸŽ€

gcc -o main.o $(sdl2-config --cflags) main.c

is how u might use sdl2-config to compile a C source file for an executable program. πŸ¦‹

gcc -o my_app $(sdl2-config --libs) main.o util.o

is how u might use sdl2-config to link compiled objects into an executable program. 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

pkgconf(1), pkg-config(1), pc(5), pkg.m4(7)


πŸ’œ AUTHOR πŸ’œ

The Simple DirectMedia Layer (SDL) library was written by Sam Lantinga.

This manual page was written by Branden Robinson, originally for Progeny Linux Systems, Inc., and the Debian Project. Updated in 2013 by Manuel A. Fernandez Montecelo <mafm@debian.org>. Updated in 2024 by Simon McVittie.


and that's the whole page bestie 🫢 this was SDL 2.0, dated 2024-01-10, straight from the sdl2-config(1) era β€” go forth and link ur little heart out πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from