sdl2-config(1)
β¨ 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 frompkg.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 optionallyfind_package(SDL2 CONFIG COMPONENTS SDL2main), then link toSDL2::SDL2and optionallySDL2::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]β ifDIRis 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]β ifDIRis 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:--prefixand--exec-prefixhave GOT to come before--cflags,--libsand--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
- debian trixie: libsdl2-compat-dev 2.32.54+ds-1 Β· Zlib
- debian trixie: libsdl2-dev 2.32.4+dfsg-1 Β· zlib/libpng AND zlib-libpng-like-permissive
- ubuntu noble: libsdl2-dev 2.30.0+dfsg-1build3 Β· zlib/libpng AND zlib-libpng-like-permissive
- ubuntu noble: libsdl2-dev 2.30.0+dfsg-1ubuntu3.1 Β· zlib/libpng AND zlib-libpng-like-permissive
- ubuntu questing: libsdl2-compat-dev 2.32.56+ds-2
- ubuntu questing: libsdl2-dev 2.32.4+dfsg-1
- ubuntu resolute: libsdl2-compat-dev 2.32.64+ds-1 Β· Zlib
- ubuntu resolute: libsdl2-dev 2.32.10+dfsg-6 Β· zlib/libpng AND zlib-libpng-like-permissive
- ubuntu stonking: libsdl2-dev 2.32.70+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms