| 1 |
.TH sdl2-config 1 "2024-01-10" "SDL 2.0" |
| 2 |
.SH NAME |
| 3 |
sdl2-config \- script to get information about the installed version of SDL |
| 4 |
.SH SYNOPSIS |
| 5 |
.B sdl2-config |
| 6 |
[\fB--prefix\fR[\fB=\fIDIR\fR]] |
| 7 |
[\fB--exec-prefix\fR[\fB=\fIDIR\fR]] |
| 8 |
[\fB--version\fR] |
| 9 |
[\fB--cflags\fR] |
| 10 |
[\fB--libs\fR] |
| 11 |
[\fB--static-libs\fR] |
| 12 |
.SH DESCRIPTION |
| 13 |
.B sdl2-config |
| 14 |
is a tool that is used to configure and determine the compiler and linker |
| 15 |
flags that should be used to compile and link programs, libraries, and |
| 16 |
plugins that use SDL. It is also used internally by the m4 macros that are |
| 17 |
included with SDL. |
| 18 |
.P |
| 19 |
In new code, consider using |
| 20 |
.BR pkg-config (1) |
| 21 |
or |
| 22 |
.BR pkgconf (1) |
| 23 |
instead of |
| 24 |
.B sdl2-config. |
| 25 |
To support cross-compiling, if the environment variable |
| 26 |
.B PKG_CONFIG |
| 27 |
is set, its value should be used instead of the literal name |
| 28 |
.B pkg-config |
| 29 |
or |
| 30 |
.BR pkgconf . |
| 31 |
.P |
| 32 |
In Autotools build systems, the preferred way to detect SDL is with the |
| 33 |
.B "PKG_CHECK_MODULES([SDL], [sdl2])" |
| 34 |
macro invocation from |
| 35 |
.BR pkg.m4 (7). |
| 36 |
.P |
| 37 |
In Meson build systems, the preferred way to detect SDL is with Meson's |
| 38 |
usual |
| 39 |
.B dependency('sdl2') |
| 40 |
function call. |
| 41 |
.P |
| 42 |
In CMake build systems, the preferred way to detect SDL is to use |
| 43 |
.B "find_package(SDL2 CONFIG)" |
| 44 |
and optionally |
| 45 |
.BR "find_package(SDL2 CONFIG COMPONENTS SDL2main)" , |
| 46 |
then link to |
| 47 |
.B SDL2::SDL2 |
| 48 |
and optionally |
| 49 |
.BR SDL2::SDL2main . |
| 50 |
.SH OPTIONS |
| 51 |
.TP |
| 52 |
.B --cflags |
| 53 |
Print the compiler flags that are necessary to compile a program or library |
| 54 |
that uses SDL. |
| 55 |
.IP |
| 56 |
The pkg-config equivalent is |
| 57 |
.BR "${PKG_CONFIG:-pkg-config} --cflags sdl2" . |
| 58 |
.TP |
| 59 |
.BI --exec-prefix\fR[=\fIDIR\fR] |
| 60 |
If \fIDIR\fR is not specified, print the exec prefix of the current SDL |
| 61 |
installation. |
| 62 |
The pkg-config equivalent is |
| 63 |
.BR "${PKG_CONFIG:-pkg-config} --variable=exec_prefix sdl2" . |
| 64 |
.IP |
| 65 |
If \fIDIR\fR is specified, use it instead of the installation exec prefix that |
| 66 |
SDL was built with when computing the output for the --cflags, --libs and |
| 67 |
--static-libs options. This option must be specified before any of the options |
| 68 |
--cflags, --libs and --static-libs. |
| 69 |
The pkg-config equivalent is |
| 70 |
.B ${PKG_CONFIG:-pkg-config} |
| 71 |
.BI --define-variable=exec_prefix= DIR |
| 72 |
.BR "" [ --cflags | --libs "|...]" |
| 73 |
.BR sdl2 . |
| 74 |
.TP |
| 75 |
.B --libs |
| 76 |
Print the linker flags that are necessary to link a program that uses SDL. |
| 77 |
.IP |
| 78 |
The pkg-config equivalent is |
| 79 |
.BR "${PKG_CONFIG:-pkg-config} --libs sdl2" . |
| 80 |
.TP |
| 81 |
.B --static-libs |
| 82 |
Print the linker flags that are necessary to statically link a program that uses SDL. |
| 83 |
.IP |
| 84 |
The pkg-config equivalent is |
| 85 |
.BR "${PKG_CONFIG:-pkg-config} --static --libs sdl2" . |
| 86 |
.TP |
| 87 |
.BI --prefix\fR[=\fIDIR\fR] |
| 88 |
If \fIDIR\fR is not specified, print the prefix of the current SDL installation. |
| 89 |
The pkg-config equivalent is |
| 90 |
.BR "${PKG_CONFIG:-pkg-config} --variable=prefix sdl2" . |
| 91 |
.IP |
| 92 |
If \fIDIR\fR is specified, use it instead of the installation prefix that SDL |
| 93 |
was built with when computing the output for the --cflags, --libs and |
| 94 |
--static-libs options. This option is also used for the exec prefix if |
| 95 |
--exec-prefix was not specified. This option must be specified before any of |
| 96 |
the options --cflags, --libs and --static-libs. |
| 97 |
The pkg-config equivalent is |
| 98 |
.B ${PKG_CONFIG:-pkg-config} |
| 99 |
.BI --define-variable=prefix= DIR |
| 100 |
.BR "" [ --cflags | --libs "|...]" |
| 101 |
.BR sdl2 . |
| 102 |
.TP |
| 103 |
.B --version |
| 104 |
Prints the currently installed version of SDL on standard output. |
| 105 |
The pkg-config equivalent is |
| 106 |
.B ${PKG_CONFIG:-pkg-config} --modversion |
| 107 |
.BR sdl2 . |
| 108 |
.SH EXAMPLES |
| 109 |
.TP |
| 110 |
gcc -o main.o $(sdl2-config --cflags) main.c |
| 111 |
is how you might use |
| 112 |
.B sdl2-config |
| 113 |
to compile a C source file for an executable program. |
| 114 |
.TP |
| 115 |
gcc -o my_app $(sdl2-config --libs) main.o util.o |
| 116 |
is how you might use |
| 117 |
.B sdl2-config |
| 118 |
to link compiled objects into an executable program. |
| 119 |
.SH SEE ALSO |
| 120 |
.BR pkgconf (1), |
| 121 |
.BR pkg-config (1), |
| 122 |
.BR pc (5), |
| 123 |
.BR pkg.m4 (7) |
| 124 |
.SH AUTHOR |
| 125 |
The Simple DirectMedia Layer (SDL) library was written by Sam Lantinga. |
| 126 |
.PP |
| 127 |
This manual page was written by Branden Robinson, originally for Progeny |
| 128 |
Linux Systems, Inc., and the Debian Project. |
| 129 |
.br |
| 130 |
Updated in 2013 by Manuel A. Fernandez Montecelo <[email protected]>. |
| 131 |
.br |
| 132 |
Updated in 2024 by Simon McVittie. |