Merge lp:~brandontschaefer/libsdl/add-mir-support-v2 into lp:ubuntu/wily/libsdl1.2
- add-mir-support-v2
- Merge into wily
Status: | Needs review |
---|---|
Proposed branch: | lp:~brandontschaefer/libsdl/add-mir-support-v2 |
Merge into: | lp:ubuntu/wily/libsdl1.2 |
Diff against target: |
9066 lines (+8851/-2) 26 files modified
.pc/applied-patches (+1/-0) .pc/mir-support.diff/configure.in (+2965/-0) .pc/mir-support.diff/include/SDL_config.h.in (+312/-0) .pc/mir-support.diff/src/video/SDL_sysvideo.h (+424/-0) .pc/mir-support.diff/src/video/SDL_video.c (+1978/-0) configure.in (+38/-0) debian/changelog (+6/-0) debian/control (+8/-2) debian/patches/mir-support.diff (+1632/-0) debian/patches/series (+1/-0) debian/rules (+4/-0) include/SDL_config.h.in (+1/-0) src/video/SDL_sysvideo.h (+3/-0) src/video/SDL_video.c (+3/-0) src/video/mir/SDL_mirbuffer.c (+58/-0) src/video/mir/SDL_mirbuffer.h (+32/-0) src/video/mir/SDL_mirevents.c (+264/-0) src/video/mir/SDL_mirevents.h (+33/-0) src/video/mir/SDL_mirgl.c (+218/-0) src/video/mir/SDL_mirgl.h (+55/-0) src/video/mir/SDL_mirhw.c (+46/-0) src/video/mir/SDL_mirhw.h (+36/-0) src/video/mir/SDL_mirmouse.c (+62/-0) src/video/mir/SDL_mirmouse.h (+37/-0) src/video/mir/SDL_mirvideo.c (+590/-0) src/video/mir/SDL_mirvideo.h (+44/-0) |
To merge this branch: | bzr merge lp:~brandontschaefer/libsdl/add-mir-support-v2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
VCS imports | Pending | ||
Review via email: mp+260774@code.launchpad.net |
This proposal supersedes a proposal from 2015-06-01.
Commit message
Add support for Mir under libsdl1.2 for only i386/amd64 (no gles1/2 support in libsdl1.2).
Description of the change
Add support for Mir under libsdl1.2 for only i386/amd64 (no gles1/2 support in libsdl1.2).
This patch adds support for Software rendering and Opengl on the desktop for mir in sdl1.2.
*Note* This is written for the new libmir 0.13.1. This uses new event 2.0 and buffering system.
Daniel van Vugt (vanvugt) wrote : | # |
Wow that's annoying proposing to a tree that has .pc/applied-patches
Reviewers should just be aware to ignore most of the diff (.pc/*).
Unmerged revisions
- 53. By Brandon Schaefer
-
* I should not ignore key_repeat rather, if we are not a KEY_UP action
assume its a KEY_DOWN event. - 52. By Brandon Schaefer
-
* Make sure we depend on the version of mir this is written for
- 51. By Brandon Schaefer
-
* Add video driver backend support for Mir (i386/amd64)
Preview Diff
1 | === modified file '.pc/applied-patches' | |||
2 | --- .pc/applied-patches 2014-07-01 23:03:57 +0000 | |||
3 | +++ .pc/applied-patches 2015-06-01 21:48:23 +0000 | |||
4 | @@ -4,3 +4,4 @@ | |||
5 | 4 | fix_window_resizing.diff | 4 | fix_window_resizing.diff |
6 | 5 | fix_joystick_misc_axes.diff | 5 | fix_joystick_misc_axes.diff |
7 | 6 | sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch | 6 | sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch |
8 | 7 | mir-support.diff | ||
9 | 7 | 8 | ||
10 | === added directory '.pc/mir-support.diff' | |||
11 | === added file '.pc/mir-support.diff/configure.in' | |||
12 | --- .pc/mir-support.diff/configure.in 1970-01-01 00:00:00 +0000 | |||
13 | +++ .pc/mir-support.diff/configure.in 2015-06-01 21:48:23 +0000 | |||
14 | @@ -0,0 +1,2965 @@ | |||
15 | 1 | dnl Process this file with autoconf to produce a configure script. | ||
16 | 2 | AC_INIT(README) | ||
17 | 3 | AC_CONFIG_HEADER(include/SDL_config.h) | ||
18 | 4 | AC_GNU_SOURCE | ||
19 | 5 | AC_CONFIG_AUX_DIRS($srcdir/build-scripts) | ||
20 | 6 | |||
21 | 7 | dnl Set various version strings - taken gratefully from the GTk sources | ||
22 | 8 | # | ||
23 | 9 | # Making releases: | ||
24 | 10 | # Edit include/SDL/SDL_version.h and change the version, then: | ||
25 | 11 | # SDL_MICRO_VERSION += 1; | ||
26 | 12 | # SDL_INTERFACE_AGE += 1; | ||
27 | 13 | # SDL_BINARY_AGE += 1; | ||
28 | 14 | # if any functions have been added, set SDL_INTERFACE_AGE to 0. | ||
29 | 15 | # if backwards compatibility has been broken, | ||
30 | 16 | # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. | ||
31 | 17 | # | ||
32 | 18 | SDL_MAJOR_VERSION=1 | ||
33 | 19 | SDL_MINOR_VERSION=2 | ||
34 | 20 | SDL_MICRO_VERSION=15 | ||
35 | 21 | SDL_INTERFACE_AGE=4 | ||
36 | 22 | SDL_BINARY_AGE=15 | ||
37 | 23 | SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION | ||
38 | 24 | |||
39 | 25 | AC_SUBST(SDL_MAJOR_VERSION) | ||
40 | 26 | AC_SUBST(SDL_MINOR_VERSION) | ||
41 | 27 | AC_SUBST(SDL_MICRO_VERSION) | ||
42 | 28 | AC_SUBST(SDL_INTERFACE_AGE) | ||
43 | 29 | AC_SUBST(SDL_BINARY_AGE) | ||
44 | 30 | AC_SUBST(SDL_VERSION) | ||
45 | 31 | |||
46 | 32 | # libtool versioning | ||
47 | 33 | LT_INIT([win32-dll]) | ||
48 | 34 | |||
49 | 35 | LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION | ||
50 | 36 | LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` | ||
51 | 37 | LT_REVISION=$SDL_INTERFACE_AGE | ||
52 | 38 | LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` | ||
53 | 39 | m4_pattern_allow([^LT_]) | ||
54 | 40 | |||
55 | 41 | AC_SUBST(LT_RELEASE) | ||
56 | 42 | AC_SUBST(LT_CURRENT) | ||
57 | 43 | AC_SUBST(LT_REVISION) | ||
58 | 44 | AC_SUBST(LT_AGE) | ||
59 | 45 | |||
60 | 46 | dnl Detect the canonical build and host environments | ||
61 | 47 | AC_CONFIG_AUX_DIR([build-scripts]) | ||
62 | 48 | dnl AC_CANONICAL_HOST | ||
63 | 49 | AC_C_BIGENDIAN | ||
64 | 50 | if test x$ac_cv_c_bigendian = xyes; then | ||
65 | 51 | AC_DEFINE(SDL_BYTEORDER, 4321) | ||
66 | 52 | else | ||
67 | 53 | AC_DEFINE(SDL_BYTEORDER, 1234) | ||
68 | 54 | fi | ||
69 | 55 | |||
70 | 56 | dnl Check for tools | ||
71 | 57 | AC_PROG_LIBTOOL | ||
72 | 58 | AC_PROG_CC | ||
73 | 59 | AC_PROG_CXX | ||
74 | 60 | AC_PROG_INSTALL | ||
75 | 61 | AC_PROG_MAKE_SET | ||
76 | 62 | AC_CHECK_TOOL(WINDRES, [windres], [:]) | ||
77 | 63 | |||
78 | 64 | dnl Set up the compiler and linker flags | ||
79 | 65 | INCLUDE="-I$srcdir/include" | ||
80 | 66 | if test x$srcdir != x.; then | ||
81 | 67 | # Remove SDL_config.h from the source directory, since it's the | ||
82 | 68 | # default one, and we want to include the one that we generate. | ||
83 | 69 | if test -f $srcdir/include/SDL_config.h; then | ||
84 | 70 | rm $srcdir/include/SDL_config.h | ||
85 | 71 | fi | ||
86 | 72 | INCLUDE="-Iinclude $INCLUDE" | ||
87 | 73 | fi | ||
88 | 74 | case "$host" in | ||
89 | 75 | *-*-cygwin*) | ||
90 | 76 | # We build SDL on cygwin without the UNIX emulation layer | ||
91 | 77 | BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin" | ||
92 | 78 | BASE_LDFLAGS="-mno-cygwin" | ||
93 | 79 | ;; | ||
94 | 80 | *) | ||
95 | 81 | BASE_CFLAGS="-D_GNU_SOURCE=1" | ||
96 | 82 | BASE_LDFLAGS="" | ||
97 | 83 | ;; | ||
98 | 84 | esac | ||
99 | 85 | BUILD_CFLAGS="$CFLAGS $CPPFLAGS" | ||
100 | 86 | EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS" | ||
101 | 87 | BUILD_LDFLAGS="$LDFLAGS" | ||
102 | 88 | EXTRA_LDFLAGS="$BASE_LDFLAGS" | ||
103 | 89 | ## These are common directories to find software packages | ||
104 | 90 | #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do | ||
105 | 91 | # if test -d $path/include; then | ||
106 | 92 | # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include" | ||
107 | 93 | # fi | ||
108 | 94 | # if test -d $path/lib; then | ||
109 | 95 | # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib" | ||
110 | 96 | # fi | ||
111 | 97 | #done | ||
112 | 98 | SDL_CFLAGS="$BASE_CFLAGS" | ||
113 | 99 | SDL_LIBS="-lSDL $BASE_LDFLAGS" | ||
114 | 100 | CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" | ||
115 | 101 | CFLAGS="$CFLAGS $EXTRA_CFLAGS" | ||
116 | 102 | LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" | ||
117 | 103 | |||
118 | 104 | dnl set this to use on systems that use lib64 instead of lib | ||
119 | 105 | base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'` | ||
120 | 106 | |||
121 | 107 | dnl Function to find a library in the compiler search path | ||
122 | 108 | find_lib() | ||
123 | 109 | { | ||
124 | 110 | gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] | ||
125 | 111 | gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] | ||
126 | 112 | env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`] | ||
127 | 113 | if test "$cross_compiling" = yes; then | ||
128 | 114 | host_lib_path="" | ||
129 | 115 | else | ||
130 | 116 | host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" | ||
131 | 117 | fi | ||
132 | 118 | for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do | ||
133 | 119 | lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`] | ||
134 | 120 | if test x$lib != x; then | ||
135 | 121 | echo $lib | ||
136 | 122 | return | ||
137 | 123 | fi | ||
138 | 124 | done | ||
139 | 125 | } | ||
140 | 126 | |||
141 | 127 | dnl Check for compiler characteristics | ||
142 | 128 | AC_C_CONST | ||
143 | 129 | AC_C_INLINE | ||
144 | 130 | AC_C_VOLATILE | ||
145 | 131 | |||
146 | 132 | dnl See whether we are allowed to use the system C library | ||
147 | 133 | AC_ARG_ENABLE(libc, | ||
148 | 134 | AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]), | ||
149 | 135 | , enable_libc=yes) | ||
150 | 136 | if test x$enable_libc = xyes; then | ||
151 | 137 | AC_DEFINE(HAVE_LIBC) | ||
152 | 138 | |||
153 | 139 | dnl Check for C library headers | ||
154 | 140 | AC_HEADER_STDC | ||
155 | 141 | AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) | ||
156 | 142 | |||
157 | 143 | dnl Check for typedefs, structures, etc. | ||
158 | 144 | AC_TYPE_SIZE_T | ||
159 | 145 | if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then | ||
160 | 146 | AC_CHECK_TYPE(int64_t) | ||
161 | 147 | if test x$ac_cv_type_int64_t = xyes; then | ||
162 | 148 | AC_DEFINE(SDL_HAS_64BIT_TYPE) | ||
163 | 149 | fi | ||
164 | 150 | have_inttypes=yes | ||
165 | 151 | fi | ||
166 | 152 | |||
167 | 153 | dnl Checks for library functions. | ||
168 | 154 | case "$host" in | ||
169 | 155 | *-*-cygwin* | *-*-mingw32*) | ||
170 | 156 | ;; | ||
171 | 157 | *) | ||
172 | 158 | AC_FUNC_ALLOCA | ||
173 | 159 | ;; | ||
174 | 160 | esac | ||
175 | 161 | |||
176 | 162 | AC_FUNC_MEMCMP | ||
177 | 163 | if test x$ac_cv_func_memcmp_working = xyes; then | ||
178 | 164 | AC_DEFINE(HAVE_MEMCMP) | ||
179 | 165 | fi | ||
180 | 166 | AC_FUNC_STRTOD | ||
181 | 167 | if test x$ac_cv_func_strtod = xyes; then | ||
182 | 168 | AC_DEFINE(HAVE_STRTOD) | ||
183 | 169 | fi | ||
184 | 170 | AC_CHECK_FUNC(mprotect, | ||
185 | 171 | AC_TRY_COMPILE([ | ||
186 | 172 | #include <sys/types.h> | ||
187 | 173 | #include <sys/mman.h> | ||
188 | 174 | ],[ | ||
189 | 175 | ],[ | ||
190 | 176 | AC_DEFINE(HAVE_MPROTECT) | ||
191 | 177 | ]), | ||
192 | 178 | ) | ||
193 | 179 | AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf iconv sigaction setjmp nanosleep) | ||
194 | 180 | |||
195 | 181 | AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) | ||
196 | 182 | AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) | ||
197 | 183 | |||
198 | 184 | AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>]) | ||
199 | 185 | fi | ||
200 | 186 | |||
201 | 187 | if test x$have_inttypes != xyes; then | ||
202 | 188 | AC_CHECK_SIZEOF(char, 1) | ||
203 | 189 | AC_CHECK_SIZEOF(short, 2) | ||
204 | 190 | AC_CHECK_SIZEOF(int, 4) | ||
205 | 191 | AC_CHECK_SIZEOF(long, 4) | ||
206 | 192 | AC_CHECK_SIZEOF(long long, 8) | ||
207 | 193 | if test x$ac_cv_sizeof_char = x1; then | ||
208 | 194 | AC_DEFINE(int8_t, signed char) | ||
209 | 195 | AC_DEFINE(uint8_t, unsigned char) | ||
210 | 196 | fi | ||
211 | 197 | if test x$ac_cv_sizeof_short = x2; then | ||
212 | 198 | AC_DEFINE(int16_t, signed short) | ||
213 | 199 | AC_DEFINE(uint16_t, unsigned short) | ||
214 | 200 | else | ||
215 | 201 | if test x$ac_cv_sizeof_int = x2; then | ||
216 | 202 | AC_DEFINE(int16_t, signed int) | ||
217 | 203 | AC_DEFINE(uint16_t, unsigned int) | ||
218 | 204 | fi | ||
219 | 205 | fi | ||
220 | 206 | if test x$ac_cv_sizeof_int = x4; then | ||
221 | 207 | AC_DEFINE(int32_t, signed int) | ||
222 | 208 | AC_DEFINE(uint32_t, unsigned int) | ||
223 | 209 | else | ||
224 | 210 | if test x$ac_cv_sizeof_long = x4; then | ||
225 | 211 | AC_DEFINE(int32_t, signed long) | ||
226 | 212 | AC_DEFINE(uint32_t, unsigned long) | ||
227 | 213 | fi | ||
228 | 214 | fi | ||
229 | 215 | if test x$ac_cv_sizeof_long = x8; then | ||
230 | 216 | AC_DEFINE(int64_t, signed long) | ||
231 | 217 | AC_DEFINE(uint64_t, unsigned long) | ||
232 | 218 | AC_DEFINE(SDL_HAS_64BIT_TYPE) | ||
233 | 219 | else | ||
234 | 220 | if test x$ac_cv_sizeof_long_long = x8; then | ||
235 | 221 | AC_DEFINE(int64_t, signed long long) | ||
236 | 222 | AC_DEFINE(uint64_t, unsigned long long) | ||
237 | 223 | AC_DEFINE(SDL_HAS_64BIT_TYPE) | ||
238 | 224 | fi | ||
239 | 225 | fi | ||
240 | 226 | AC_DEFINE(size_t, unsigned int) | ||
241 | 227 | AC_DEFINE(uintptr_t, unsigned long) | ||
242 | 228 | fi | ||
243 | 229 | |||
244 | 230 | # Standard C sources | ||
245 | 231 | SOURCES="$SOURCES $srcdir/src/*.c" | ||
246 | 232 | SOURCES="$SOURCES $srcdir/src/audio/*.c" | ||
247 | 233 | SOURCES="$SOURCES $srcdir/src/cdrom/*.c" | ||
248 | 234 | SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c" | ||
249 | 235 | SOURCES="$SOURCES $srcdir/src/events/*.c" | ||
250 | 236 | SOURCES="$SOURCES $srcdir/src/file/*.c" | ||
251 | 237 | SOURCES="$SOURCES $srcdir/src/stdlib/*.c" | ||
252 | 238 | SOURCES="$SOURCES $srcdir/src/thread/*.c" | ||
253 | 239 | SOURCES="$SOURCES $srcdir/src/timer/*.c" | ||
254 | 240 | SOURCES="$SOURCES $srcdir/src/video/*.c" | ||
255 | 241 | |||
256 | 242 | dnl Enable/disable various subsystems of the SDL library | ||
257 | 243 | |||
258 | 244 | AC_ARG_ENABLE(audio, | ||
259 | 245 | AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), | ||
260 | 246 | , enable_audio=yes) | ||
261 | 247 | if test x$enable_audio != xyes; then | ||
262 | 248 | AC_DEFINE(SDL_AUDIO_DISABLED) | ||
263 | 249 | fi | ||
264 | 250 | AC_ARG_ENABLE(video, | ||
265 | 251 | AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]), | ||
266 | 252 | , enable_video=yes) | ||
267 | 253 | if test x$enable_video != xyes; then | ||
268 | 254 | AC_DEFINE(SDL_VIDEO_DISABLED) | ||
269 | 255 | fi | ||
270 | 256 | AC_ARG_ENABLE(events, | ||
271 | 257 | AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]), | ||
272 | 258 | , enable_events=yes) | ||
273 | 259 | if test x$enable_events != xyes; then | ||
274 | 260 | AC_DEFINE(SDL_EVENTS_DISABLED) | ||
275 | 261 | fi | ||
276 | 262 | AC_ARG_ENABLE(joystick, | ||
277 | 263 | AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]), | ||
278 | 264 | , enable_joystick=yes) | ||
279 | 265 | if test x$enable_joystick != xyes; then | ||
280 | 266 | AC_DEFINE(SDL_JOYSTICK_DISABLED) | ||
281 | 267 | else | ||
282 | 268 | SOURCES="$SOURCES $srcdir/src/joystick/*.c" | ||
283 | 269 | fi | ||
284 | 270 | AC_ARG_ENABLE(cdrom, | ||
285 | 271 | AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [[default=yes]]]), | ||
286 | 272 | , enable_cdrom=yes) | ||
287 | 273 | if test x$enable_cdrom != xyes; then | ||
288 | 274 | AC_DEFINE(SDL_CDROM_DISABLED) | ||
289 | 275 | fi | ||
290 | 276 | AC_ARG_ENABLE(threads, | ||
291 | 277 | AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), | ||
292 | 278 | , enable_threads=yes) | ||
293 | 279 | if test x$enable_threads != xyes; then | ||
294 | 280 | AC_DEFINE(SDL_THREADS_DISABLED) | ||
295 | 281 | fi | ||
296 | 282 | AC_ARG_ENABLE(timers, | ||
297 | 283 | AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]), | ||
298 | 284 | , enable_timers=yes) | ||
299 | 285 | if test x$enable_timers != xyes; then | ||
300 | 286 | AC_DEFINE(SDL_TIMERS_DISABLED) | ||
301 | 287 | fi | ||
302 | 288 | AC_ARG_ENABLE(file, | ||
303 | 289 | AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]), | ||
304 | 290 | , enable_file=yes) | ||
305 | 291 | if test x$enable_file != xyes; then | ||
306 | 292 | AC_DEFINE(SDL_FILE_DISABLED) | ||
307 | 293 | fi | ||
308 | 294 | AC_ARG_ENABLE(loadso, | ||
309 | 295 | AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]), | ||
310 | 296 | , enable_loadso=yes) | ||
311 | 297 | if test x$enable_loadso != xyes; then | ||
312 | 298 | AC_DEFINE(SDL_LOADSO_DISABLED) | ||
313 | 299 | fi | ||
314 | 300 | AC_ARG_ENABLE(cpuinfo, | ||
315 | 301 | AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]), | ||
316 | 302 | , enable_cpuinfo=yes) | ||
317 | 303 | if test x$enable_cpuinfo != xyes; then | ||
318 | 304 | AC_DEFINE(SDL_CPUINFO_DISABLED) | ||
319 | 305 | fi | ||
320 | 306 | AC_ARG_ENABLE(assembly, | ||
321 | 307 | AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]), | ||
322 | 308 | , enable_assembly=yes) | ||
323 | 309 | if test x$enable_assembly = xyes; then | ||
324 | 310 | AC_DEFINE(SDL_ASSEMBLY_ROUTINES) | ||
325 | 311 | fi | ||
326 | 312 | |||
327 | 313 | dnl See if the OSS audio interface is supported | ||
328 | 314 | CheckOSS() | ||
329 | 315 | { | ||
330 | 316 | AC_ARG_ENABLE(oss, | ||
331 | 317 | AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]), | ||
332 | 318 | , enable_oss=yes) | ||
333 | 319 | if test x$enable_audio = xyes -a x$enable_oss = xyes; then | ||
334 | 320 | AC_MSG_CHECKING(for OSS audio support) | ||
335 | 321 | have_oss=no | ||
336 | 322 | if test x$have_oss != xyes; then | ||
337 | 323 | AC_TRY_COMPILE([ | ||
338 | 324 | #include <sys/soundcard.h> | ||
339 | 325 | ],[ | ||
340 | 326 | int arg = SNDCTL_DSP_SETFRAGMENT; | ||
341 | 327 | ],[ | ||
342 | 328 | have_oss=yes | ||
343 | 329 | ]) | ||
344 | 330 | fi | ||
345 | 331 | if test x$have_oss != xyes; then | ||
346 | 332 | AC_TRY_COMPILE([ | ||
347 | 333 | #include <soundcard.h> | ||
348 | 334 | ],[ | ||
349 | 335 | int arg = SNDCTL_DSP_SETFRAGMENT; | ||
350 | 336 | ],[ | ||
351 | 337 | have_oss=yes | ||
352 | 338 | AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H) | ||
353 | 339 | ]) | ||
354 | 340 | fi | ||
355 | 341 | AC_MSG_RESULT($have_oss) | ||
356 | 342 | if test x$have_oss = xyes; then | ||
357 | 343 | AC_DEFINE(SDL_AUDIO_DRIVER_OSS) | ||
358 | 344 | SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c" | ||
359 | 345 | SOURCES="$SOURCES $srcdir/src/audio/dma/*.c" | ||
360 | 346 | have_audio=yes | ||
361 | 347 | |||
362 | 348 | # We may need to link with ossaudio emulation library | ||
363 | 349 | case "$host" in | ||
364 | 350 | *-*-openbsd*|*-*-netbsd*) | ||
365 | 351 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; | ||
366 | 352 | esac | ||
367 | 353 | fi | ||
368 | 354 | fi | ||
369 | 355 | } | ||
370 | 356 | |||
371 | 357 | dnl See if the ALSA audio interface is supported | ||
372 | 358 | CheckALSA() | ||
373 | 359 | { | ||
374 | 360 | AC_ARG_ENABLE(alsa, | ||
375 | 361 | AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), | ||
376 | 362 | , enable_alsa=yes) | ||
377 | 363 | if test x$enable_audio = xyes -a x$enable_alsa = xyes; then | ||
378 | 364 | AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no) | ||
379 | 365 | # Restore all flags from before the ALSA detection runs | ||
380 | 366 | CFLAGS="$alsa_save_CFLAGS" | ||
381 | 367 | LDFLAGS="$alsa_save_LDFLAGS" | ||
382 | 368 | LIBS="$alsa_save_LIBS" | ||
383 | 369 | if test x$have_alsa = xyes; then | ||
384 | 370 | AC_ARG_ENABLE(alsa-shared, | ||
385 | 371 | AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]), | ||
386 | 372 | , enable_alsa_shared=yes) | ||
387 | 373 | alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
388 | 374 | |||
389 | 375 | AC_DEFINE(SDL_AUDIO_DRIVER_ALSA) | ||
390 | 376 | SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" | ||
391 | 377 | EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" | ||
392 | 378 | if test x$have_loadso != xyes && \ | ||
393 | 379 | test x$enable_alsa_shared = xyes; then | ||
394 | 380 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading]) | ||
395 | 381 | fi | ||
396 | 382 | if test x$have_loadso = xyes && \ | ||
397 | 383 | test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then | ||
398 | 384 | echo "-- dynamic libasound -> $alsa_lib" | ||
399 | 385 | AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib") | ||
400 | 386 | else | ||
401 | 387 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS" | ||
402 | 388 | fi | ||
403 | 389 | have_audio=yes | ||
404 | 390 | fi | ||
405 | 391 | fi | ||
406 | 392 | } | ||
407 | 393 | |||
408 | 394 | dnl Check whether we want to use IRIX 6.5+ native audio or not | ||
409 | 395 | CheckDMEDIA() | ||
410 | 396 | { | ||
411 | 397 | if test x$enable_audio = xyes; then | ||
412 | 398 | AC_MSG_CHECKING(for dmedia audio support) | ||
413 | 399 | have_dmedia=no | ||
414 | 400 | AC_TRY_COMPILE([ | ||
415 | 401 | #include <dmedia/audio.h> | ||
416 | 402 | ],[ | ||
417 | 403 | ALport audio_port; | ||
418 | 404 | ],[ | ||
419 | 405 | have_dmedia=yes | ||
420 | 406 | ]) | ||
421 | 407 | AC_MSG_RESULT($have_dmedia) | ||
422 | 408 | # Set up files for the audio library | ||
423 | 409 | if test x$have_dmedia = xyes; then | ||
424 | 410 | AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA) | ||
425 | 411 | SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c" | ||
426 | 412 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio" | ||
427 | 413 | have_audio=yes | ||
428 | 414 | fi | ||
429 | 415 | fi | ||
430 | 416 | } | ||
431 | 417 | |||
432 | 418 | dnl Check whether we want to use Tru64 UNIX native audio or not | ||
433 | 419 | CheckMME() | ||
434 | 420 | { | ||
435 | 421 | dnl Make sure we are running on an Tru64 UNIX | ||
436 | 422 | case $ARCH in | ||
437 | 423 | osf) | ||
438 | 424 | ;; | ||
439 | 425 | *) | ||
440 | 426 | return | ||
441 | 427 | ;; | ||
442 | 428 | esac | ||
443 | 429 | if test x$enable_audio = xyes; then | ||
444 | 430 | AC_MSG_CHECKING(for MME audio support) | ||
445 | 431 | MME_CFLAGS="-I/usr/include/mme" | ||
446 | 432 | MME_LIBS="-lmme" | ||
447 | 433 | have_mme=no | ||
448 | 434 | save_CFLAGS="$CFLAGS" | ||
449 | 435 | CFLAGS="$CFLAGS $MME_CFLAGS" | ||
450 | 436 | AC_TRY_COMPILE([ | ||
451 | 437 | #include <mme_api.h> | ||
452 | 438 | ],[ | ||
453 | 439 | HWAVEOUT sound; | ||
454 | 440 | ],[ | ||
455 | 441 | have_mme=yes | ||
456 | 442 | ]) | ||
457 | 443 | CFLAGS="$save_CFLAGS" | ||
458 | 444 | AC_MSG_RESULT($have_mme) | ||
459 | 445 | # Set up files for the audio library | ||
460 | 446 | if test x$have_mme = xyes; then | ||
461 | 447 | AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO) | ||
462 | 448 | SOURCES="$SOURCES $srcdir/src/audio/mme/*.c" | ||
463 | 449 | EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS" | ||
464 | 450 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS" | ||
465 | 451 | have_audio=yes | ||
466 | 452 | fi | ||
467 | 453 | fi | ||
468 | 454 | } | ||
469 | 455 | |||
470 | 456 | dnl Find the ESD includes and libraries | ||
471 | 457 | CheckESD() | ||
472 | 458 | { | ||
473 | 459 | AC_ARG_ENABLE(esd, | ||
474 | 460 | AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]), | ||
475 | 461 | , enable_esd=yes) | ||
476 | 462 | if test x$enable_audio = xyes -a x$enable_esd = xyes; then | ||
477 | 463 | AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) | ||
478 | 464 | if test x$have_esd = xyes; then | ||
479 | 465 | AC_ARG_ENABLE(esd-shared, | ||
480 | 466 | AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]), | ||
481 | 467 | , enable_esd_shared=yes) | ||
482 | 468 | esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
483 | 469 | |||
484 | 470 | AC_DEFINE(SDL_AUDIO_DRIVER_ESD) | ||
485 | 471 | SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" | ||
486 | 472 | EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" | ||
487 | 473 | if test x$have_loadso != xyes && \ | ||
488 | 474 | test x$enable_esd_shared = xyes; then | ||
489 | 475 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading]) | ||
490 | 476 | fi | ||
491 | 477 | if test x$have_loadso = xyes && \ | ||
492 | 478 | test x$enable_esd_shared = xyes && test x$esd_lib != x; then | ||
493 | 479 | echo "-- dynamic libesd -> $esd_lib" | ||
494 | 480 | AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib") | ||
495 | 481 | else | ||
496 | 482 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" | ||
497 | 483 | fi | ||
498 | 484 | have_audio=yes | ||
499 | 485 | fi | ||
500 | 486 | fi | ||
501 | 487 | } | ||
502 | 488 | |||
503 | 489 | dnl Find PulseAudio | ||
504 | 490 | CheckPulseAudio() | ||
505 | 491 | { | ||
506 | 492 | AC_ARG_ENABLE(pulseaudio, | ||
507 | 493 | AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]), | ||
508 | 494 | , enable_pulseaudio=yes) | ||
509 | 495 | if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then | ||
510 | 496 | audio_pulse=no | ||
511 | 497 | |||
512 | 498 | PULSE_REQUIRED_VERSION=0.9 | ||
513 | 499 | |||
514 | 500 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | ||
515 | 501 | AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support) | ||
516 | 502 | if test x$PKG_CONFIG != xno; then | ||
517 | 503 | if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then | ||
518 | 504 | PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple` | ||
519 | 505 | PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple` | ||
520 | 506 | audio_pulse=yes | ||
521 | 507 | fi | ||
522 | 508 | fi | ||
523 | 509 | AC_MSG_RESULT($audio_pulse) | ||
524 | 510 | |||
525 | 511 | if test x$audio_pulse = xyes; then | ||
526 | 512 | AC_ARG_ENABLE(pulseaudio-shared, | ||
527 | 513 | AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]), | ||
528 | 514 | , enable_pulseaudio_shared=yes) | ||
529 | 515 | pulse_lib=[`find_lib "libpulse-simple.so.*" "$PULSE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
530 | 516 | |||
531 | 517 | AC_DEFINE(SDL_AUDIO_DRIVER_PULSE) | ||
532 | 518 | SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c" | ||
533 | 519 | EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS" | ||
534 | 520 | if test x$have_loadso != xyes && \ | ||
535 | 521 | test x$enable_pulseaudio_shared = xyes; then | ||
536 | 522 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading]) | ||
537 | 523 | fi | ||
538 | 524 | if test x$have_loadso = xyes && \ | ||
539 | 525 | test x$enable_pulseaudio_shared = xyes && test x$pulse_lib != x; then | ||
540 | 526 | echo "-- dynamic libpulse-simple -> $pulse_lib" | ||
541 | 527 | AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSE_DYNAMIC, "$pulse_lib") | ||
542 | 528 | else | ||
543 | 529 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSE_LIBS" | ||
544 | 530 | fi | ||
545 | 531 | have_audio=yes | ||
546 | 532 | fi | ||
547 | 533 | fi | ||
548 | 534 | } | ||
549 | 535 | |||
550 | 536 | CheckARTSC() | ||
551 | 537 | { | ||
552 | 538 | AC_ARG_ENABLE(arts, | ||
553 | 539 | AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]), | ||
554 | 540 | , enable_arts=yes) | ||
555 | 541 | if test x$enable_audio = xyes -a x$enable_arts = xyes; then | ||
556 | 542 | AC_PATH_PROG(ARTSCONFIG, artsc-config) | ||
557 | 543 | if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then | ||
558 | 544 | : # arts isn't installed | ||
559 | 545 | else | ||
560 | 546 | ARTS_CFLAGS=`$ARTSCONFIG --cflags` | ||
561 | 547 | ARTS_LIBS=`$ARTSCONFIG --libs` | ||
562 | 548 | AC_MSG_CHECKING(for aRts development environment) | ||
563 | 549 | audio_arts=no | ||
564 | 550 | save_CFLAGS="$CFLAGS" | ||
565 | 551 | CFLAGS="$CFLAGS $ARTS_CFLAGS" | ||
566 | 552 | AC_TRY_COMPILE([ | ||
567 | 553 | #include <artsc.h> | ||
568 | 554 | ],[ | ||
569 | 555 | arts_stream_t stream; | ||
570 | 556 | ],[ | ||
571 | 557 | audio_arts=yes | ||
572 | 558 | ]) | ||
573 | 559 | CFLAGS="$save_CFLAGS" | ||
574 | 560 | AC_MSG_RESULT($audio_arts) | ||
575 | 561 | if test x$audio_arts = xyes; then | ||
576 | 562 | AC_ARG_ENABLE(arts-shared, | ||
577 | 563 | AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]), | ||
578 | 564 | , enable_arts_shared=yes) | ||
579 | 565 | arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
580 | 566 | |||
581 | 567 | AC_DEFINE(SDL_AUDIO_DRIVER_ARTS) | ||
582 | 568 | SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" | ||
583 | 569 | EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" | ||
584 | 570 | if test x$have_loadso != xyes && \ | ||
585 | 571 | test x$enable_arts_shared = xyes; then | ||
586 | 572 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading]) | ||
587 | 573 | fi | ||
588 | 574 | if test x$have_loadso = xyes && \ | ||
589 | 575 | test x$enable_arts_shared = xyes && test x$arts_lib != x; then | ||
590 | 576 | echo "-- dynamic libartsc -> $arts_lib" | ||
591 | 577 | AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib") | ||
592 | 578 | else | ||
593 | 579 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" | ||
594 | 580 | fi | ||
595 | 581 | have_audio=yes | ||
596 | 582 | fi | ||
597 | 583 | fi | ||
598 | 584 | fi | ||
599 | 585 | } | ||
600 | 586 | |||
601 | 587 | dnl See if the NAS audio interface is supported | ||
602 | 588 | CheckNAS() | ||
603 | 589 | { | ||
604 | 590 | AC_ARG_ENABLE(nas, | ||
605 | 591 | AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), | ||
606 | 592 | , enable_nas=yes) | ||
607 | 593 | if test x$enable_audio = xyes -a x$enable_nas = xyes; then | ||
608 | 594 | AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes) | ||
609 | 595 | AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes) | ||
610 | 596 | |||
611 | 597 | AC_MSG_CHECKING(for NAS audio support) | ||
612 | 598 | have_nas=no | ||
613 | 599 | |||
614 | 600 | if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then | ||
615 | 601 | have_nas=yes | ||
616 | 602 | NAS_LIBS="-laudio" | ||
617 | 603 | |||
618 | 604 | elif test -r /usr/X11R6/include/audio/audiolib.h; then | ||
619 | 605 | have_nas=yes | ||
620 | 606 | NAS_CFLAGS="-I/usr/X11R6/include/" | ||
621 | 607 | NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" | ||
622 | 608 | |||
623 | 609 | dnl On IRIX, the NAS includes are in a different directory, | ||
624 | 610 | dnl and libnas must be explicitly linked in | ||
625 | 611 | |||
626 | 612 | elif test -r /usr/freeware/include/nas/audiolib.h; then | ||
627 | 613 | have_nas=yes | ||
628 | 614 | NAS_LIBS="-lnas -lXt" | ||
629 | 615 | fi | ||
630 | 616 | |||
631 | 617 | AC_MSG_RESULT($have_nas) | ||
632 | 618 | |||
633 | 619 | if test x$have_nas = xyes; then | ||
634 | 620 | AC_ARG_ENABLE(nas-shared, | ||
635 | 621 | AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]), | ||
636 | 622 | , enable_nas_shared=yes) | ||
637 | 623 | nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
638 | 624 | |||
639 | 625 | if test x$have_loadso != xyes && \ | ||
640 | 626 | test x$enable_nas_shared = xyes; then | ||
641 | 627 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading]) | ||
642 | 628 | fi | ||
643 | 629 | if test x$have_loadso = xyes && \ | ||
644 | 630 | test x$enable_nas_shared = xyes && test x$nas_lib != x; then | ||
645 | 631 | echo "-- dynamic libaudio -> $nas_lib" | ||
646 | 632 | AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib") | ||
647 | 633 | else | ||
648 | 634 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" | ||
649 | 635 | fi | ||
650 | 636 | |||
651 | 637 | AC_DEFINE(SDL_AUDIO_DRIVER_NAS) | ||
652 | 638 | SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" | ||
653 | 639 | EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" | ||
654 | 640 | have_audio=yes | ||
655 | 641 | fi | ||
656 | 642 | fi | ||
657 | 643 | } | ||
658 | 644 | |||
659 | 645 | dnl rcg07142001 See if the user wants the disk writer audio driver... | ||
660 | 646 | CheckDiskAudio() | ||
661 | 647 | { | ||
662 | 648 | AC_ARG_ENABLE(diskaudio, | ||
663 | 649 | AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]), | ||
664 | 650 | , enable_diskaudio=yes) | ||
665 | 651 | if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then | ||
666 | 652 | AC_DEFINE(SDL_AUDIO_DRIVER_DISK) | ||
667 | 653 | SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" | ||
668 | 654 | fi | ||
669 | 655 | } | ||
670 | 656 | |||
671 | 657 | dnl rcg03142006 See if the user wants the dummy audio driver... | ||
672 | 658 | CheckDummyAudio() | ||
673 | 659 | { | ||
674 | 660 | AC_ARG_ENABLE(dummyaudio, | ||
675 | 661 | AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]), | ||
676 | 662 | , enable_dummyaudio=yes) | ||
677 | 663 | if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then | ||
678 | 664 | AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY) | ||
679 | 665 | SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" | ||
680 | 666 | fi | ||
681 | 667 | } | ||
682 | 668 | |||
683 | 669 | dnl Set up the Atari Audio driver | ||
684 | 670 | CheckAtariAudio() | ||
685 | 671 | { | ||
686 | 672 | AC_ARG_ENABLE(mintaudio, | ||
687 | 673 | AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [[default=yes]]]), | ||
688 | 674 | , enable_mintaudio=yes) | ||
689 | 675 | if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then | ||
690 | 676 | mintaudio=no | ||
691 | 677 | AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes) | ||
692 | 678 | if test x$have_mint_falcon_hdr = xyes; then | ||
693 | 679 | mintaudio=yes | ||
694 | 680 | AC_DEFINE(SDL_AUDIO_DRIVER_MINT) | ||
695 | 681 | SOURCES="$SOURCES $srcdir/src/audio/mint/*.c" | ||
696 | 682 | SOURCES="$SOURCES $srcdir/src/audio/mint/*.S" | ||
697 | 683 | have_audio=yes | ||
698 | 684 | fi | ||
699 | 685 | fi | ||
700 | 686 | } | ||
701 | 687 | |||
702 | 688 | dnl See if we can use x86 assembly blitters | ||
703 | 689 | # NASM is available from: http://nasm.sourceforge.net | ||
704 | 690 | CheckNASM() | ||
705 | 691 | { | ||
706 | 692 | dnl Make sure we are running on an x86 platform | ||
707 | 693 | case $host in | ||
708 | 694 | i?86*) | ||
709 | 695 | ;; | ||
710 | 696 | *) | ||
711 | 697 | # Nope, bail early. | ||
712 | 698 | return | ||
713 | 699 | ;; | ||
714 | 700 | esac | ||
715 | 701 | |||
716 | 702 | dnl Mac OS X might report itself as "i386" but generate x86_64 code. | ||
717 | 703 | dnl So see what size we think a pointer is, and bail if not 32-bit. | ||
718 | 704 | AC_CHECK_SIZEOF([void *], 4) | ||
719 | 705 | if test x$ac_cv_sizeof_void_p != x4; then | ||
720 | 706 | return | ||
721 | 707 | fi | ||
722 | 708 | |||
723 | 709 | dnl Check for NASM (for assembly blit routines) | ||
724 | 710 | AC_ARG_ENABLE(nasm, | ||
725 | 711 | AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [[default=yes]]]), | ||
726 | 712 | , enable_nasm=yes) | ||
727 | 713 | if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then | ||
728 | 714 | CompileNASM() | ||
729 | 715 | { | ||
730 | 716 | # Usage: CompileNASM <filename> | ||
731 | 717 | AC_MSG_CHECKING(to see if $NASM supports $1) | ||
732 | 718 | if $NASM $NASMFLAGS $1 -o $1.o >&AS_MESSAGE_LOG_FD 2>&1; then | ||
733 | 719 | CompileNASM_ret="yes" | ||
734 | 720 | else | ||
735 | 721 | CompileNASM_ret="no" | ||
736 | 722 | fi | ||
737 | 723 | rm -f $1 $1.o | ||
738 | 724 | AC_MSG_RESULT($CompileNASM_ret) | ||
739 | 725 | test "$CompileNASM_ret" = "yes" | ||
740 | 726 | } | ||
741 | 727 | |||
742 | 728 | if test x"$NASMFLAGS" = x; then | ||
743 | 729 | case $ARCH in | ||
744 | 730 | win32) | ||
745 | 731 | NASMFLAGS="-f win32" | ||
746 | 732 | ;; | ||
747 | 733 | macosx) | ||
748 | 734 | NASMFLAGS="-f macho" | ||
749 | 735 | ;; | ||
750 | 736 | *) | ||
751 | 737 | NASMFLAGS="-f elf32" | ||
752 | 738 | ;; | ||
753 | 739 | esac | ||
754 | 740 | fi | ||
755 | 741 | |||
756 | 742 | AC_PATH_PROG(NASM, nasm) | ||
757 | 743 | echo "%ifidn __OUTPUT_FORMAT__,elf32" > unquoted-sections | ||
758 | 744 | echo "section .note.GNU-stack noalloc noexec nowrite progbits" >> unquoted-sections | ||
759 | 745 | echo "%endif" >> unquoted-sections | ||
760 | 746 | CompileNASM unquoted-sections || NASM="" | ||
761 | 747 | |||
762 | 748 | if test "x$NASM" != x -a "x$NASM" != x'"$NASM"'; then | ||
763 | 749 | AC_DEFINE(SDL_HERMES_BLITTERS) | ||
764 | 750 | SOURCES="$SOURCES $srcdir/src/hermes/*.asm" | ||
765 | 751 | NASMFLAGS="$NASMFLAGS -I $srcdir/src/hermes/" | ||
766 | 752 | |||
767 | 753 | dnl See if hidden visibility is supported | ||
768 | 754 | echo "GLOBAL _bar:function hidden" > symbol-visibility | ||
769 | 755 | echo "_bar:" >> symbol-visibility | ||
770 | 756 | CompileNASM symbol-visibility && NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY" | ||
771 | 757 | |||
772 | 758 | AC_SUBST(NASM) | ||
773 | 759 | AC_SUBST(NASMFLAGS) | ||
774 | 760 | |||
775 | 761 | case "$host" in | ||
776 | 762 | # this line is needed for QNX, because it's not defined the __ELF__ | ||
777 | 763 | *-*-qnx*) | ||
778 | 764 | EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";; | ||
779 | 765 | *-*-solaris*) | ||
780 | 766 | EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";; | ||
781 | 767 | esac | ||
782 | 768 | fi | ||
783 | 769 | fi | ||
784 | 770 | } | ||
785 | 771 | |||
786 | 772 | dnl Check for altivec instruction support using gas syntax | ||
787 | 773 | CheckAltivec() | ||
788 | 774 | { | ||
789 | 775 | AC_ARG_ENABLE(altivec, | ||
790 | 776 | AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [[default=yes]]]), | ||
791 | 777 | , enable_altivec=yes) | ||
792 | 778 | if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then | ||
793 | 779 | save_CFLAGS="$CFLAGS" | ||
794 | 780 | have_gcc_altivec=no | ||
795 | 781 | have_altivec_h_hdr=no | ||
796 | 782 | altivec_CFLAGS="-maltivec" | ||
797 | 783 | CFLAGS="$save_CFLAGS $altivec_CFLAGS" | ||
798 | 784 | |||
799 | 785 | AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option) | ||
800 | 786 | AC_TRY_COMPILE([ | ||
801 | 787 | #include <altivec.h> | ||
802 | 788 | vector unsigned int vzero() { | ||
803 | 789 | return vec_splat_u32(0); | ||
804 | 790 | } | ||
805 | 791 | ],[ | ||
806 | 792 | ],[ | ||
807 | 793 | have_gcc_altivec=yes | ||
808 | 794 | have_altivec_h_hdr=yes | ||
809 | 795 | ]) | ||
810 | 796 | AC_MSG_RESULT($have_gcc_altivec) | ||
811 | 797 | |||
812 | 798 | if test x$have_gcc_altivec = xno; then | ||
813 | 799 | AC_MSG_CHECKING(for Altivec with GCC -maltivec option) | ||
814 | 800 | AC_TRY_COMPILE([ | ||
815 | 801 | vector unsigned int vzero() { | ||
816 | 802 | return vec_splat_u32(0); | ||
817 | 803 | } | ||
818 | 804 | ],[ | ||
819 | 805 | ],[ | ||
820 | 806 | have_gcc_altivec=yes | ||
821 | 807 | ]) | ||
822 | 808 | AC_MSG_RESULT($have_gcc_altivec) | ||
823 | 809 | fi | ||
824 | 810 | |||
825 | 811 | if test x$have_gcc_altivec = xno; then | ||
826 | 812 | AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option) | ||
827 | 813 | altivec_CFLAGS="-faltivec" | ||
828 | 814 | CFLAGS="$save_CFLAGS $altivec_CFLAGS" | ||
829 | 815 | AC_TRY_COMPILE([ | ||
830 | 816 | #include <altivec.h> | ||
831 | 817 | vector unsigned int vzero() { | ||
832 | 818 | return vec_splat_u32(0); | ||
833 | 819 | } | ||
834 | 820 | ],[ | ||
835 | 821 | ],[ | ||
836 | 822 | have_gcc_altivec=yes | ||
837 | 823 | have_altivec_h_hdr=yes | ||
838 | 824 | ]) | ||
839 | 825 | AC_MSG_RESULT($have_gcc_altivec) | ||
840 | 826 | fi | ||
841 | 827 | |||
842 | 828 | if test x$have_gcc_altivec = xno; then | ||
843 | 829 | AC_MSG_CHECKING(for Altivec with GCC -faltivec option) | ||
844 | 830 | AC_TRY_COMPILE([ | ||
845 | 831 | vector unsigned int vzero() { | ||
846 | 832 | return vec_splat_u32(0); | ||
847 | 833 | } | ||
848 | 834 | ],[ | ||
849 | 835 | ],[ | ||
850 | 836 | have_gcc_altivec=yes | ||
851 | 837 | ]) | ||
852 | 838 | AC_MSG_RESULT($have_gcc_altivec) | ||
853 | 839 | fi | ||
854 | 840 | CFLAGS="$save_CFLAGS" | ||
855 | 841 | |||
856 | 842 | if test x$have_gcc_altivec = xyes; then | ||
857 | 843 | AC_DEFINE(SDL_ALTIVEC_BLITTERS) | ||
858 | 844 | if test x$have_altivec_h_hdr = xyes; then | ||
859 | 845 | AC_DEFINE(HAVE_ALTIVEC_H) | ||
860 | 846 | fi | ||
861 | 847 | EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" | ||
862 | 848 | fi | ||
863 | 849 | fi | ||
864 | 850 | } | ||
865 | 851 | |||
866 | 852 | dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). | ||
867 | 853 | dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility | ||
868 | 854 | CheckVisibilityHidden() | ||
869 | 855 | { | ||
870 | 856 | AC_MSG_CHECKING(for GCC -fvisibility=hidden option) | ||
871 | 857 | have_gcc_fvisibility=no | ||
872 | 858 | |||
873 | 859 | visibility_CFLAGS="-fvisibility=hidden" | ||
874 | 860 | save_CFLAGS="$CFLAGS" | ||
875 | 861 | CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror" | ||
876 | 862 | AC_TRY_COMPILE([ | ||
877 | 863 | #if !defined(__GNUC__) || __GNUC__ < 4 | ||
878 | 864 | #error SDL only uses visibility attributes in GCC 4 or newer | ||
879 | 865 | #endif | ||
880 | 866 | ],[ | ||
881 | 867 | ],[ | ||
882 | 868 | have_gcc_fvisibility=yes | ||
883 | 869 | ]) | ||
884 | 870 | AC_MSG_RESULT($have_gcc_fvisibility) | ||
885 | 871 | CFLAGS="$save_CFLAGS" | ||
886 | 872 | |||
887 | 873 | if test x$have_gcc_fvisibility = xyes; then | ||
888 | 874 | EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS" | ||
889 | 875 | fi | ||
890 | 876 | } | ||
891 | 877 | |||
892 | 878 | dnl See if GCC's -Wall is supported. | ||
893 | 879 | CheckWarnAll() | ||
894 | 880 | { | ||
895 | 881 | AC_MSG_CHECKING(for GCC -Wall option) | ||
896 | 882 | have_gcc_Wall=no | ||
897 | 883 | |||
898 | 884 | save_CFLAGS="$CFLAGS" | ||
899 | 885 | CFLAGS="$save_CFLAGS -Wall" | ||
900 | 886 | AC_TRY_COMPILE([ | ||
901 | 887 | int x = 0; | ||
902 | 888 | ],[ | ||
903 | 889 | ],[ | ||
904 | 890 | have_gcc_Wall=yes | ||
905 | 891 | ]) | ||
906 | 892 | AC_MSG_RESULT($have_gcc_Wall) | ||
907 | 893 | CFLAGS="$save_CFLAGS" | ||
908 | 894 | |||
909 | 895 | if test x$have_gcc_Wall = xyes; then | ||
910 | 896 | EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" | ||
911 | 897 | |||
912 | 898 | dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. | ||
913 | 899 | AC_MSG_CHECKING(for necessary GCC -Wno-multichar option) | ||
914 | 900 | need_gcc_Wno_multichar=no | ||
915 | 901 | case "$host" in | ||
916 | 902 | *-*-beos* | *-*-haiku*) | ||
917 | 903 | need_gcc_Wno_multichar=yes | ||
918 | 904 | ;; | ||
919 | 905 | esac | ||
920 | 906 | AC_MSG_RESULT($need_gcc_Wno_multichar) | ||
921 | 907 | if test x$need_gcc_Wno_multichar = xyes; then | ||
922 | 908 | EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar" | ||
923 | 909 | fi | ||
924 | 910 | fi | ||
925 | 911 | } | ||
926 | 912 | |||
927 | 913 | |||
928 | 914 | dnl Do the iPod thing | ||
929 | 915 | CheckIPod() | ||
930 | 916 | { | ||
931 | 917 | AC_ARG_ENABLE(ipod, | ||
932 | 918 | AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [[default=no]]]), | ||
933 | 919 | , enable_ipod=no) | ||
934 | 920 | |||
935 | 921 | if test x$enable_ipod = xyes; then | ||
936 | 922 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DIPOD" | ||
937 | 923 | AC_DEFINE(SDL_VIDEO_DRIVER_IPOD) | ||
938 | 924 | SOURCES="$SOURCES $srcdir/src/video/ipod/*.c" | ||
939 | 925 | fi | ||
940 | 926 | } | ||
941 | 927 | |||
942 | 928 | dnl Find the nanox include and library directories | ||
943 | 929 | CheckNANOX() | ||
944 | 930 | { | ||
945 | 931 | AC_ARG_ENABLE(video-nanox, | ||
946 | 932 | AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [[default=no]]]), | ||
947 | 933 | , enable_video_nanox=no) | ||
948 | 934 | |||
949 | 935 | if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then | ||
950 | 936 | AC_ARG_ENABLE(nanox-debug, | ||
951 | 937 | AC_HELP_STRING([--enable-nanox-debug], [print debug messages [[default=no]]]), | ||
952 | 938 | , enable_nanox_debug=no) | ||
953 | 939 | if test x$enable_nanox_debug = xyes; then | ||
954 | 940 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG" | ||
955 | 941 | fi | ||
956 | 942 | |||
957 | 943 | AC_ARG_ENABLE(nanox-share-memory, | ||
958 | 944 | AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [[default=no]]]), | ||
959 | 945 | , enable_nanox_share_memory=no) | ||
960 | 946 | if test x$enable_nanox_share_memory = xyes; then | ||
961 | 947 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY" | ||
962 | 948 | fi | ||
963 | 949 | |||
964 | 950 | AC_ARG_ENABLE(nanox_direct_fb, | ||
965 | 951 | AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [[default=no]]]), | ||
966 | 952 | , enable_nanox_direct_fb=no) | ||
967 | 953 | if test x$enable_nanox_direct_fb = xyes; then | ||
968 | 954 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB" | ||
969 | 955 | fi | ||
970 | 956 | |||
971 | 957 | AC_DEFINE(SDL_VIDEO_DRIVER_NANOX) | ||
972 | 958 | SOURCES="$SOURCES $srcdir/src/video/nanox/*.c" | ||
973 | 959 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X" | ||
974 | 960 | have_video=yes | ||
975 | 961 | fi | ||
976 | 962 | } | ||
977 | 963 | |||
978 | 964 | dnl Find the X11 include and library directories | ||
979 | 965 | CheckX11() | ||
980 | 966 | { | ||
981 | 967 | AC_ARG_ENABLE(video-x11, | ||
982 | 968 | AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), | ||
983 | 969 | , enable_video_x11=yes) | ||
984 | 970 | if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then | ||
985 | 971 | case "$host" in | ||
986 | 972 | *-*-darwin*) | ||
987 | 973 | # This isn't necessary for X11, but fixes GLX detection | ||
988 | 974 | if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then | ||
989 | 975 | x_includes="/usr/X11R6/include" | ||
990 | 976 | x_libraries="/usr/X11R6/lib" | ||
991 | 977 | fi | ||
992 | 978 | ;; | ||
993 | 979 | esac | ||
994 | 980 | AC_PATH_X | ||
995 | 981 | AC_PATH_XTRA | ||
996 | 982 | if test x$have_x = xyes; then | ||
997 | 983 | # Only allow dynamically loaded X11 if the X11 function pointers | ||
998 | 984 | # will not end up in the global namespace, which causes problems | ||
999 | 985 | # with other libraries calling X11 functions. | ||
1000 | 986 | x11_symbols_private=$have_gcc_fvisibility | ||
1001 | 987 | |||
1002 | 988 | AC_ARG_ENABLE(x11-shared, | ||
1003 | 989 | AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]), | ||
1004 | 990 | , enable_x11_shared=maybe) | ||
1005 | 991 | |||
1006 | 992 | case "$host" in | ||
1007 | 993 | *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs... | ||
1008 | 994 | x11_symbols_private=yes | ||
1009 | 995 | x11_lib='/usr/X11R6/lib/libX11.6.dylib' | ||
1010 | 996 | x11ext_lib='/usr/X11R6/lib/libXext.6.dylib' | ||
1011 | 997 | xrender_lib='/usr/X11R6/lib/libXrender.1.dylib' | ||
1012 | 998 | xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib' | ||
1013 | 999 | ;; | ||
1014 | 1000 | *-*-osf*) | ||
1015 | 1001 | x11_lib='libX11.so' | ||
1016 | 1002 | x11ext_lib='libXext.so' | ||
1017 | 1003 | ;; | ||
1018 | 1004 | *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32 | ||
1019 | 1005 | x11_lib='libX11.so' | ||
1020 | 1006 | x11ext_lib='libXext.so' | ||
1021 | 1007 | ;; | ||
1022 | 1008 | *) | ||
1023 | 1009 | x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
1024 | 1010 | x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
1025 | 1011 | xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
1026 | 1012 | xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] | ||
1027 | 1013 | ;; | ||
1028 | 1014 | esac | ||
1029 | 1015 | |||
1030 | 1016 | X_CFLAGS="$X_CFLAGS -DXTHREADS" | ||
1031 | 1017 | if test x$ac_cv_func_shmat != xyes; then | ||
1032 | 1018 | X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY" | ||
1033 | 1019 | fi | ||
1034 | 1020 | CFLAGS="$CFLAGS $X_CFLAGS" | ||
1035 | 1021 | LDFLAGS="$LDFLAGS $X_LIBS" | ||
1036 | 1022 | |||
1037 | 1023 | AC_DEFINE(SDL_VIDEO_DRIVER_X11) | ||
1038 | 1024 | SOURCES="$SOURCES $srcdir/src/video/x11/*.c" | ||
1039 | 1025 | EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" | ||
1040 | 1026 | |||
1041 | 1027 | if test x$enable_x11_shared = xmaybe; then | ||
1042 | 1028 | enable_x11_shared=$x11_symbols_private | ||
1043 | 1029 | fi | ||
1044 | 1030 | if test x$have_loadso != xyes && \ | ||
1045 | 1031 | test x$enable_x11_shared = xyes; then | ||
1046 | 1032 | AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading]) | ||
1047 | 1033 | enable_x11_shared=no | ||
1048 | 1034 | fi | ||
1049 | 1035 | if test x$x11_symbols_private != xyes && \ | ||
1050 | 1036 | test x$enable_x11_shared = xyes; then | ||
1051 | 1037 | AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading]) | ||
1052 | 1038 | enable_x11_shared=no | ||
1053 | 1039 | fi | ||
1054 | 1040 | |||
1055 | 1041 | if test x$have_loadso = xyes && \ | ||
1056 | 1042 | test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then | ||
1057 | 1043 | echo "-- dynamic libX11 -> $x11_lib" | ||
1058 | 1044 | echo "-- dynamic libX11ext -> $x11ext_lib" | ||
1059 | 1045 | AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib") | ||
1060 | 1046 | AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib") | ||
1061 | 1047 | else | ||
1062 | 1048 | enable_x11_shared=no | ||
1063 | 1049 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext" | ||
1064 | 1050 | fi | ||
1065 | 1051 | have_video=yes | ||
1066 | 1052 | |||
1067 | 1053 | AC_ARG_ENABLE(dga, | ||
1068 | 1054 | AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [[default=yes]]]), | ||
1069 | 1055 | , enable_dga=yes) | ||
1070 | 1056 | if test x$enable_dga = xyes; then | ||
1071 | 1057 | SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c" | ||
1072 | 1058 | fi | ||
1073 | 1059 | AC_ARG_ENABLE(video-dga, | ||
1074 | 1060 | AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [[default=yes]]]), | ||
1075 | 1061 | , enable_video_dga=yes) | ||
1076 | 1062 | if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then | ||
1077 | 1063 | AC_DEFINE(SDL_VIDEO_DRIVER_DGA) | ||
1078 | 1064 | SOURCES="$SOURCES $srcdir/src/video/dga/*.c" | ||
1079 | 1065 | fi | ||
1080 | 1066 | AC_ARG_ENABLE(video-x11-dgamouse, | ||
1081 | 1067 | AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [[default=yes]]]), | ||
1082 | 1068 | , enable_video_x11_dgamouse=yes) | ||
1083 | 1069 | if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then | ||
1084 | 1070 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE) | ||
1085 | 1071 | fi | ||
1086 | 1072 | AC_ARG_ENABLE(video-x11-vm, | ||
1087 | 1073 | AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]), | ||
1088 | 1074 | , enable_video_x11_vm=yes) | ||
1089 | 1075 | if test x$enable_video_x11_vm = xyes; then | ||
1090 | 1076 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE) | ||
1091 | 1077 | SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c" | ||
1092 | 1078 | fi | ||
1093 | 1079 | AC_ARG_ENABLE(video-x11-xv, | ||
1094 | 1080 | AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]), | ||
1095 | 1081 | , enable_video_x11_xv=yes) | ||
1096 | 1082 | if test x$enable_video_x11_xv = xyes; then | ||
1097 | 1083 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV) | ||
1098 | 1084 | SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c" | ||
1099 | 1085 | fi | ||
1100 | 1086 | AC_ARG_ENABLE(video-x11-xinerama, | ||
1101 | 1087 | AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]), | ||
1102 | 1088 | , enable_video_x11_xinerama=yes) | ||
1103 | 1089 | if test x$enable_video_x11_xinerama = xyes; then | ||
1104 | 1090 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA) | ||
1105 | 1091 | SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c" | ||
1106 | 1092 | fi | ||
1107 | 1093 | AC_ARG_ENABLE(video-x11-xme, | ||
1108 | 1094 | AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]), | ||
1109 | 1095 | , enable_video_x11_xme=yes) | ||
1110 | 1096 | if test x$enable_video_x11_xme = xyes; then | ||
1111 | 1097 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME) | ||
1112 | 1098 | SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c" | ||
1113 | 1099 | fi | ||
1114 | 1100 | AC_ARG_ENABLE(video-x11-xrandr, | ||
1115 | 1101 | AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]), | ||
1116 | 1102 | , enable_video_x11_xrandr=yes) | ||
1117 | 1103 | if test x$enable_video_x11_xrandr = xyes; then | ||
1118 | 1104 | definitely_enable_video_x11_xrandr=no | ||
1119 | 1105 | AC_CHECK_HEADER(X11/extensions/Xrandr.h, | ||
1120 | 1106 | have_xrandr_h_hdr=yes, | ||
1121 | 1107 | have_xrandr_h_hdr=no, | ||
1122 | 1108 | [#include <X11/Xlib.h> | ||
1123 | 1109 | ]) | ||
1124 | 1110 | if test x$have_xrandr_h_hdr = xyes; then | ||
1125 | 1111 | if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then | ||
1126 | 1112 | echo "-- dynamic libXrender -> $xrender_lib" | ||
1127 | 1113 | echo "-- dynamic libXrandr -> $xrandr_lib" | ||
1128 | 1114 | AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib") | ||
1129 | 1115 | AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib") | ||
1130 | 1116 | definitely_enable_video_x11_xrandr=yes | ||
1131 | 1117 | else | ||
1132 | 1118 | AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes) | ||
1133 | 1119 | AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes) | ||
1134 | 1120 | if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then | ||
1135 | 1121 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender" | ||
1136 | 1122 | definitely_enable_video_x11_xrandr=yes | ||
1137 | 1123 | fi | ||
1138 | 1124 | fi | ||
1139 | 1125 | fi | ||
1140 | 1126 | fi | ||
1141 | 1127 | if test x$definitely_enable_video_x11_xrandr = xyes; then | ||
1142 | 1128 | AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR) | ||
1143 | 1129 | fi | ||
1144 | 1130 | fi | ||
1145 | 1131 | fi | ||
1146 | 1132 | } | ||
1147 | 1133 | |||
1148 | 1134 | dnl Check for QNX photon video driver | ||
1149 | 1135 | CheckPHOTON() | ||
1150 | 1136 | { | ||
1151 | 1137 | AC_ARG_ENABLE(video-photon, | ||
1152 | 1138 | AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]), | ||
1153 | 1139 | , enable_video_photon=yes) | ||
1154 | 1140 | if test x$enable_video = xyes -a x$enable_video_photon = xyes; then | ||
1155 | 1141 | AC_MSG_CHECKING(for QNX Photon support) | ||
1156 | 1142 | video_photon=no | ||
1157 | 1143 | AC_TRY_COMPILE([ | ||
1158 | 1144 | #include <Ph.h> | ||
1159 | 1145 | #include <Pt.h> | ||
1160 | 1146 | #include <photon/Pg.h> | ||
1161 | 1147 | #include <photon/PdDirect.h> | ||
1162 | 1148 | ],[ | ||
1163 | 1149 | PgDisplaySettings_t *visual; | ||
1164 | 1150 | ],[ | ||
1165 | 1151 | video_photon=yes | ||
1166 | 1152 | ]) | ||
1167 | 1153 | AC_MSG_RESULT($video_photon) | ||
1168 | 1154 | if test x$video_photon = xyes; then | ||
1169 | 1155 | AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON) | ||
1170 | 1156 | SOURCES="$SOURCES $srcdir/src/video/photon/*.c" | ||
1171 | 1157 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph" | ||
1172 | 1158 | have_video=yes | ||
1173 | 1159 | |||
1174 | 1160 | CheckOpenGLQNX | ||
1175 | 1161 | fi | ||
1176 | 1162 | fi | ||
1177 | 1163 | } | ||
1178 | 1164 | |||
1179 | 1165 | dnl Set up the BWindow video driver if enabled | ||
1180 | 1166 | CheckBWINDOW() | ||
1181 | 1167 | { | ||
1182 | 1168 | if test x$enable_video = xyes; then | ||
1183 | 1169 | AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW) | ||
1184 | 1170 | SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc" | ||
1185 | 1171 | have_video=yes | ||
1186 | 1172 | fi | ||
1187 | 1173 | } | ||
1188 | 1174 | |||
1189 | 1175 | dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin) | ||
1190 | 1176 | CheckCARBON() | ||
1191 | 1177 | { | ||
1192 | 1178 | AC_ARG_ENABLE(video-carbon, | ||
1193 | 1179 | AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [[default=no]]]), | ||
1194 | 1180 | , enable_video_carbon=no) | ||
1195 | 1181 | if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then | ||
1196 | 1182 | AC_MSG_CHECKING(for Carbon framework) | ||
1197 | 1183 | have_carbon=no | ||
1198 | 1184 | AC_TRY_COMPILE([ | ||
1199 | 1185 | #include <Carbon/Carbon.h> | ||
1200 | 1186 | ],[ | ||
1201 | 1187 | ],[ | ||
1202 | 1188 | have_carbon=yes | ||
1203 | 1189 | ]) | ||
1204 | 1190 | AC_MSG_RESULT($have_carbon) | ||
1205 | 1191 | if test x$have_carbon = xyes; then | ||
1206 | 1192 | AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX) | ||
1207 | 1193 | SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c" | ||
1208 | 1194 | SOURCES="$SOURCES $srcdir/src/video/macrom/*.c" | ||
1209 | 1195 | have_video=yes | ||
1210 | 1196 | fi | ||
1211 | 1197 | fi | ||
1212 | 1198 | } | ||
1213 | 1199 | |||
1214 | 1200 | dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin) | ||
1215 | 1201 | CheckCOCOA() | ||
1216 | 1202 | { | ||
1217 | 1203 | AC_ARG_ENABLE(video-cocoa, | ||
1218 | 1204 | AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [[default=yes]]]), | ||
1219 | 1205 | , enable_video_cocoa=yes) | ||
1220 | 1206 | if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then | ||
1221 | 1207 | save_CFLAGS="$CFLAGS" | ||
1222 | 1208 | dnl work around that we don't have Objective-C support in autoconf | ||
1223 | 1209 | CFLAGS="$CFLAGS -x objective-c" | ||
1224 | 1210 | AC_MSG_CHECKING(for Cocoa framework) | ||
1225 | 1211 | have_cocoa=no | ||
1226 | 1212 | AC_TRY_COMPILE([ | ||
1227 | 1213 | #import <Cocoa/Cocoa.h> | ||
1228 | 1214 | ],[ | ||
1229 | 1215 | ],[ | ||
1230 | 1216 | have_cocoa=yes | ||
1231 | 1217 | ]) | ||
1232 | 1218 | AC_MSG_RESULT($have_cocoa) | ||
1233 | 1219 | CFLAGS="$save_CFLAGS" | ||
1234 | 1220 | if test x$have_cocoa = xyes; then | ||
1235 | 1221 | AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ) | ||
1236 | 1222 | SOURCES="$SOURCES $srcdir/src/video/quartz/*.m" | ||
1237 | 1223 | have_video=yes | ||
1238 | 1224 | fi | ||
1239 | 1225 | fi | ||
1240 | 1226 | } | ||
1241 | 1227 | |||
1242 | 1228 | dnl Find the framebuffer console includes | ||
1243 | 1229 | CheckFBCON() | ||
1244 | 1230 | { | ||
1245 | 1231 | AC_ARG_ENABLE(video-fbcon, | ||
1246 | 1232 | AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=yes]]]), | ||
1247 | 1233 | , enable_video_fbcon=yes) | ||
1248 | 1234 | if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then | ||
1249 | 1235 | AC_MSG_CHECKING(for framebuffer console support) | ||
1250 | 1236 | video_fbcon=no | ||
1251 | 1237 | AC_TRY_COMPILE([ | ||
1252 | 1238 | #include <linux/fb.h> | ||
1253 | 1239 | #include <linux/kd.h> | ||
1254 | 1240 | #include <linux/keyboard.h> | ||
1255 | 1241 | ],[ | ||
1256 | 1242 | ],[ | ||
1257 | 1243 | video_fbcon=yes | ||
1258 | 1244 | ]) | ||
1259 | 1245 | AC_MSG_RESULT($video_fbcon) | ||
1260 | 1246 | if test x$video_fbcon = xyes; then | ||
1261 | 1247 | AC_CHECK_FUNCS(getpagesize) | ||
1262 | 1248 | AC_DEFINE(SDL_VIDEO_DRIVER_FBCON) | ||
1263 | 1249 | SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c" | ||
1264 | 1250 | have_video=yes | ||
1265 | 1251 | fi | ||
1266 | 1252 | fi | ||
1267 | 1253 | } | ||
1268 | 1254 | |||
1269 | 1255 | dnl Find DirectFB | ||
1270 | 1256 | CheckDirectFB() | ||
1271 | 1257 | { | ||
1272 | 1258 | AC_ARG_ENABLE(video-directfb, | ||
1273 | 1259 | AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]), | ||
1274 | 1260 | , enable_video_directfb=yes) | ||
1275 | 1261 | if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then | ||
1276 | 1262 | video_directfb=no | ||
1277 | 1263 | |||
1278 | 1264 | DIRECTFB_REQUIRED_VERSION=0.9.15 | ||
1279 | 1265 | |||
1280 | 1266 | AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no) | ||
1281 | 1267 | if test x$DIRECTFBCONFIG = xno; then | ||
1282 | 1268 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | ||
1283 | 1269 | if test x$PKG_CONFIG != xno; then | ||
1284 | 1270 | if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then | ||
1285 | 1271 | DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb` | ||
1286 | 1272 | DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb` | ||
1287 | 1273 | video_directfb=yes | ||
1288 | 1274 | fi | ||
1289 | 1275 | fi | ||
1290 | 1276 | else | ||
1291 | 1277 | set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'` | ||
1292 | 1278 | NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` | ||
1293 | 1279 | set -- `directfb-config --version | sed 's/\./ /g'` | ||
1294 | 1280 | HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3` | ||
1295 | 1281 | if test $HAVE_VERSION -ge $NEED_VERSION; then | ||
1296 | 1282 | DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags` | ||
1297 | 1283 | DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs` | ||
1298 | 1284 | video_directfb=yes | ||
1299 | 1285 | fi | ||
1300 | 1286 | fi | ||
1301 | 1287 | if test x$video_directfb = xyes; then | ||
1302 | 1288 | # SuSE 11.1 installs directfb-config without directfb-devel | ||
1303 | 1289 | save_CFLAGS="$CFLAGS" | ||
1304 | 1290 | CFLAGS="$CFLAGS $DIRECTFB_CFLAGS" | ||
1305 | 1291 | AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no) | ||
1306 | 1292 | CFLAGS="$save_CFLAGS" | ||
1307 | 1293 | video_directfb=$have_directfb_hdr | ||
1308 | 1294 | fi | ||
1309 | 1295 | AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support) | ||
1310 | 1296 | AC_MSG_RESULT($video_directfb) | ||
1311 | 1297 | |||
1312 | 1298 | if test x$video_directfb = xyes; then | ||
1313 | 1299 | AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB) | ||
1314 | 1300 | SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" | ||
1315 | 1301 | EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" | ||
1316 | 1302 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS" | ||
1317 | 1303 | have_video=yes | ||
1318 | 1304 | fi | ||
1319 | 1305 | fi | ||
1320 | 1306 | } | ||
1321 | 1307 | |||
1322 | 1308 | dnl See if we're running on PlayStation 2 hardware | ||
1323 | 1309 | CheckPS2GS() | ||
1324 | 1310 | { | ||
1325 | 1311 | AC_ARG_ENABLE(video-ps2gs, | ||
1326 | 1312 | AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]), | ||
1327 | 1313 | , enable_video_ps2gs=yes) | ||
1328 | 1314 | if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then | ||
1329 | 1315 | AC_MSG_CHECKING(for PlayStation 2 GS support) | ||
1330 | 1316 | video_ps2gs=no | ||
1331 | 1317 | AC_TRY_COMPILE([ | ||
1332 | 1318 | #include <linux/ps2/dev.h> | ||
1333 | 1319 | #include <linux/ps2/gs.h> | ||
1334 | 1320 | ],[ | ||
1335 | 1321 | ],[ | ||
1336 | 1322 | video_ps2gs=yes | ||
1337 | 1323 | ]) | ||
1338 | 1324 | AC_MSG_RESULT($video_ps2gs) | ||
1339 | 1325 | if test x$video_ps2gs = xyes; then | ||
1340 | 1326 | AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS) | ||
1341 | 1327 | SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c" | ||
1342 | 1328 | have_video=yes | ||
1343 | 1329 | fi | ||
1344 | 1330 | fi | ||
1345 | 1331 | } | ||
1346 | 1332 | |||
1347 | 1333 | dnl See if we're running on PlayStation 3 Cell hardware | ||
1348 | 1334 | CheckPS3() | ||
1349 | 1335 | { | ||
1350 | 1336 | AC_ARG_ENABLE(video-ps3, | ||
1351 | 1337 | AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]), | ||
1352 | 1338 | , enable_video_ps3=yes) | ||
1353 | 1339 | if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then | ||
1354 | 1340 | AC_MSG_CHECKING(for PlayStation 3 Cell support) | ||
1355 | 1341 | video_ps3=no | ||
1356 | 1342 | AC_TRY_COMPILE([ | ||
1357 | 1343 | #include <linux/fb.h> | ||
1358 | 1344 | #include <asm/ps3fb.h> | ||
1359 | 1345 | #include <libspe2.h> | ||
1360 | 1346 | ],[ | ||
1361 | 1347 | ],[ | ||
1362 | 1348 | video_ps3=yes | ||
1363 | 1349 | ]) | ||
1364 | 1350 | AC_MSG_RESULT($video_ps3) | ||
1365 | 1351 | if test x$video_ps3 = xyes; then | ||
1366 | 1352 | AC_DEFINE(SDL_VIDEO_DRIVER_PS3) | ||
1367 | 1353 | SOURCES="$SOURCES $srcdir/src/video/ps3/*.c" | ||
1368 | 1354 | EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include" | ||
1369 | 1355 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lbilin_scaler_spu -lfb_writer_spu -lyuv2rgb_spu -L/opt/cell/sdk/usr/lib -lspe2" | ||
1370 | 1356 | have_video=yes | ||
1371 | 1357 | fi | ||
1372 | 1358 | fi | ||
1373 | 1359 | } | ||
1374 | 1360 | |||
1375 | 1361 | dnl Find the GGI includes | ||
1376 | 1362 | CheckGGI() | ||
1377 | 1363 | { | ||
1378 | 1364 | AC_ARG_ENABLE(video-ggi, | ||
1379 | 1365 | AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [[default=no]]]), | ||
1380 | 1366 | , enable_video_ggi=no) | ||
1381 | 1367 | if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then | ||
1382 | 1368 | AC_MSG_CHECKING(for GGI support) | ||
1383 | 1369 | video_ggi=no | ||
1384 | 1370 | AC_TRY_COMPILE([ | ||
1385 | 1371 | #include <ggi/ggi.h> | ||
1386 | 1372 | #include <ggi/gii.h> | ||
1387 | 1373 | ],[ | ||
1388 | 1374 | ],[ | ||
1389 | 1375 | video_ggi=yes | ||
1390 | 1376 | ]) | ||
1391 | 1377 | AC_MSG_RESULT($video_ggi) | ||
1392 | 1378 | if test x$video_ggi = xyes; then | ||
1393 | 1379 | AC_DEFINE(SDL_VIDEO_DRIVER_GGI) | ||
1394 | 1380 | SOURCES="$SOURCES $srcdir/src/video/ggi/*.c" | ||
1395 | 1381 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg" | ||
1396 | 1382 | have_video=yes | ||
1397 | 1383 | fi | ||
1398 | 1384 | fi | ||
1399 | 1385 | } | ||
1400 | 1386 | |||
1401 | 1387 | dnl Find the SVGAlib includes and libraries | ||
1402 | 1388 | CheckSVGA() | ||
1403 | 1389 | { | ||
1404 | 1390 | AC_ARG_ENABLE(video-svga, | ||
1405 | 1391 | AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]), | ||
1406 | 1392 | , enable_video_svga=yes) | ||
1407 | 1393 | if test x$enable_video = xyes -a x$enable_video_svga = xyes; then | ||
1408 | 1394 | AC_MSG_CHECKING(for SVGAlib (1.4.0+) support) | ||
1409 | 1395 | video_svga=no | ||
1410 | 1396 | AC_TRY_COMPILE([ | ||
1411 | 1397 | #include <vga.h> | ||
1412 | 1398 | #include <vgamouse.h> | ||
1413 | 1399 | #include <vgakeyboard.h> | ||
1414 | 1400 | ],[ | ||
1415 | 1401 | if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) { | ||
1416 | 1402 | exit(0); | ||
1417 | 1403 | } | ||
1418 | 1404 | ],[ | ||
1419 | 1405 | video_svga=yes | ||
1420 | 1406 | ]) | ||
1421 | 1407 | AC_MSG_RESULT($video_svga) | ||
1422 | 1408 | if test x$video_svga = xyes; then | ||
1423 | 1409 | AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB) | ||
1424 | 1410 | SOURCES="$SOURCES $srcdir/src/video/svga/*.c" | ||
1425 | 1411 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga" | ||
1426 | 1412 | have_video=yes | ||
1427 | 1413 | fi | ||
1428 | 1414 | fi | ||
1429 | 1415 | } | ||
1430 | 1416 | |||
1431 | 1417 | dnl Find the VGL includes and libraries | ||
1432 | 1418 | CheckVGL() | ||
1433 | 1419 | { | ||
1434 | 1420 | AC_ARG_ENABLE(video-vgl, | ||
1435 | 1421 | AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]), | ||
1436 | 1422 | , enable_video_vgl=yes) | ||
1437 | 1423 | if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then | ||
1438 | 1424 | AC_MSG_CHECKING(for libVGL support) | ||
1439 | 1425 | video_vgl=no | ||
1440 | 1426 | AC_TRY_COMPILE([ | ||
1441 | 1427 | #include <sys/fbio.h> | ||
1442 | 1428 | #include <sys/consio.h> | ||
1443 | 1429 | #include <sys/kbio.h> | ||
1444 | 1430 | #include <vgl.h> | ||
1445 | 1431 | ],[ | ||
1446 | 1432 | VGLBitmap bitmap; | ||
1447 | 1433 | bitmap.Type = VIDBUF32; | ||
1448 | 1434 | bitmap.PixelBytes = 4; | ||
1449 | 1435 | exit(bitmap.Bitmap); | ||
1450 | 1436 | ],[ | ||
1451 | 1437 | video_vgl=yes | ||
1452 | 1438 | ]) | ||
1453 | 1439 | AC_MSG_RESULT($video_vgl) | ||
1454 | 1440 | if test x$video_vgl = xyes; then | ||
1455 | 1441 | AC_DEFINE(SDL_VIDEO_DRIVER_VGL) | ||
1456 | 1442 | SOURCES="$SOURCES $srcdir/src/video/vgl/*.c" | ||
1457 | 1443 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl" | ||
1458 | 1444 | have_video=yes | ||
1459 | 1445 | fi | ||
1460 | 1446 | fi | ||
1461 | 1447 | } | ||
1462 | 1448 | |||
1463 | 1449 | dnl Set up the wscons video driver if enabled | ||
1464 | 1450 | CheckWscons() | ||
1465 | 1451 | { | ||
1466 | 1452 | AC_ARG_ENABLE(video-wscons, | ||
1467 | 1453 | AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]), | ||
1468 | 1454 | , enable_video_wscons=yes) | ||
1469 | 1455 | if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then | ||
1470 | 1456 | AC_MSG_CHECKING(for wscons support) | ||
1471 | 1457 | video_wscons=no | ||
1472 | 1458 | AC_TRY_COMPILE([ | ||
1473 | 1459 | #include <sys/time.h> | ||
1474 | 1460 | #include <dev/wscons/wsconsio.h> | ||
1475 | 1461 | #include <dev/wscons/wsdisplay_usl_io.h> | ||
1476 | 1462 | ],[ | ||
1477 | 1463 | int wsmode = WSDISPLAYIO_MODE_DUMBFB; | ||
1478 | 1464 | ],[ | ||
1479 | 1465 | video_wscons=yes | ||
1480 | 1466 | ]) | ||
1481 | 1467 | AC_MSG_RESULT($video_wscons) | ||
1482 | 1468 | if test x$video_wscons = xyes; then | ||
1483 | 1469 | AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS) | ||
1484 | 1470 | SOURCES="$SOURCES $srcdir/src/video/wscons/*.c" | ||
1485 | 1471 | have_video=yes | ||
1486 | 1472 | fi | ||
1487 | 1473 | fi | ||
1488 | 1474 | } | ||
1489 | 1475 | |||
1490 | 1476 | |||
1491 | 1477 | dnl Find the AAlib includes | ||
1492 | 1478 | CheckAAlib() | ||
1493 | 1479 | { | ||
1494 | 1480 | AC_ARG_ENABLE(video-aalib, | ||
1495 | 1481 | AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [[default=no]]]), | ||
1496 | 1482 | , enable_video_aalib=no) | ||
1497 | 1483 | if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then | ||
1498 | 1484 | AC_MSG_CHECKING(for AAlib support) | ||
1499 | 1485 | video_aalib=no | ||
1500 | 1486 | AC_TRY_COMPILE([ | ||
1501 | 1487 | #include <aalib.h> | ||
1502 | 1488 | ],[ | ||
1503 | 1489 | ],[ | ||
1504 | 1490 | video_aalib=yes | ||
1505 | 1491 | ]) | ||
1506 | 1492 | AC_MSG_RESULT($video_aalib) | ||
1507 | 1493 | if test x$video_aalib = xyes; then | ||
1508 | 1494 | AC_DEFINE(SDL_VIDEO_DRIVER_AALIB) | ||
1509 | 1495 | SOURCES="$SOURCES $srcdir/src/video/aalib/*.c" | ||
1510 | 1496 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa" | ||
1511 | 1497 | have_video=yes | ||
1512 | 1498 | fi | ||
1513 | 1499 | fi | ||
1514 | 1500 | } | ||
1515 | 1501 | |||
1516 | 1502 | dnl Find the libcaca includes | ||
1517 | 1503 | CheckCaca() | ||
1518 | 1504 | { | ||
1519 | 1505 | AC_ARG_ENABLE(video-caca, | ||
1520 | 1506 | AC_HELP_STRING([--enable-video-caca], [use libcaca video driver [[default=no]]]), | ||
1521 | 1507 | , enable_video_caca=no) | ||
1522 | 1508 | if test x$enable_video = xyes -a x$enable_video_caca = xyes; then | ||
1523 | 1509 | video_caca=no | ||
1524 | 1510 | AC_PATH_PROG(CACACONFIG, caca-config, no) | ||
1525 | 1511 | if test x$CACACONFIG != xno; then | ||
1526 | 1512 | AC_MSG_CHECKING(for libcaca support) | ||
1527 | 1513 | CACA_CFLAGS=`$CACACONFIG --cflags` | ||
1528 | 1514 | CACA_LDFLAGS=`$CACACONFIG --libs` | ||
1529 | 1515 | save_CFLAGS="$CFLAGS" | ||
1530 | 1516 | AC_TRY_COMPILE([ | ||
1531 | 1517 | #include <caca.h> | ||
1532 | 1518 | ],[ | ||
1533 | 1519 | ],[ | ||
1534 | 1520 | video_caca=yes | ||
1535 | 1521 | ]) | ||
1536 | 1522 | CFLAGS="$save_CFLAGS" | ||
1537 | 1523 | AC_MSG_RESULT($video_caca) | ||
1538 | 1524 | if test x$video_caca = xyes; then | ||
1539 | 1525 | AC_DEFINE(SDL_VIDEO_DRIVER_CACA) | ||
1540 | 1526 | EXTRA_CFLAGS="$EXTRA_CFLAGS $CACA_CFLAGS" | ||
1541 | 1527 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $CACA_LDFLAGS" | ||
1542 | 1528 | SOURCES="$SOURCES $srcdir/src/video/caca/*.c" | ||
1543 | 1529 | fi | ||
1544 | 1530 | fi | ||
1545 | 1531 | fi | ||
1546 | 1532 | } | ||
1547 | 1533 | |||
1548 | 1534 | dnl Set up the QTopia video driver if enabled | ||
1549 | 1535 | CheckQtopia() | ||
1550 | 1536 | { | ||
1551 | 1537 | AC_ARG_ENABLE(video-qtopia, | ||
1552 | 1538 | AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [[default=no]]]), | ||
1553 | 1539 | , enable_video_qtopia=no) | ||
1554 | 1540 | if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then | ||
1555 | 1541 | AC_MSG_CHECKING(for Qtopia support) | ||
1556 | 1542 | video_qtopia=no | ||
1557 | 1543 | QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions" | ||
1558 | 1544 | AC_LANG_CPLUSPLUS | ||
1559 | 1545 | OLD_CXX="$CXXFLAGS" | ||
1560 | 1546 | CXXFLAGS="$QTOPIA_FLAGS" | ||
1561 | 1547 | AC_TRY_COMPILE([ | ||
1562 | 1548 | #include <qpe/qpeapplication.h> | ||
1563 | 1549 | ],[ | ||
1564 | 1550 | ],[ | ||
1565 | 1551 | video_qtopia=yes | ||
1566 | 1552 | ]) | ||
1567 | 1553 | CXXFLAGS="$OLD_CXX" | ||
1568 | 1554 | AC_MSG_RESULT($video_qtopia) | ||
1569 | 1555 | if test x$video_qtopia = xyes; then | ||
1570 | 1556 | AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA) | ||
1571 | 1557 | SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc" | ||
1572 | 1558 | SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc" | ||
1573 | 1559 | SDLMAIN_LDFLAGS="-static" | ||
1574 | 1560 | EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS" | ||
1575 | 1561 | SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main" | ||
1576 | 1562 | SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte" | ||
1577 | 1563 | have_video=yes | ||
1578 | 1564 | fi | ||
1579 | 1565 | AC_LANG_C | ||
1580 | 1566 | fi | ||
1581 | 1567 | } | ||
1582 | 1568 | |||
1583 | 1569 | dnl Set up the PicoGUI video driver if enabled | ||
1584 | 1570 | CheckPicoGUI() | ||
1585 | 1571 | { | ||
1586 | 1572 | AC_ARG_ENABLE(video-picogui, | ||
1587 | 1573 | AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [[default=no]]]), | ||
1588 | 1574 | , enable_video_picogui=no) | ||
1589 | 1575 | if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then | ||
1590 | 1576 | AC_MSG_CHECKING(for PicoGUI support) | ||
1591 | 1577 | video_picogui=no | ||
1592 | 1578 | AC_TRY_COMPILE([ | ||
1593 | 1579 | #include <picogui.h> | ||
1594 | 1580 | ],[ | ||
1595 | 1581 | ],[ | ||
1596 | 1582 | video_picogui=yes | ||
1597 | 1583 | ]) | ||
1598 | 1584 | AC_MSG_RESULT($video_picogui) | ||
1599 | 1585 | if test x$video_picogui = xyes; then | ||
1600 | 1586 | AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI) | ||
1601 | 1587 | SOURCES="$SOURCES $srcdir/src/video/picogui/*.c" | ||
1602 | 1588 | SDL_LIBS="$SDL_LIBS -lpgui" | ||
1603 | 1589 | have_video=yes | ||
1604 | 1590 | fi | ||
1605 | 1591 | fi | ||
1606 | 1592 | } | ||
1607 | 1593 | |||
1608 | 1594 | dnl Set up the Atari Bios keyboard driver | ||
1609 | 1595 | CheckAtariBiosEvent() | ||
1610 | 1596 | { | ||
1611 | 1597 | SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c" | ||
1612 | 1598 | SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S" | ||
1613 | 1599 | } | ||
1614 | 1600 | |||
1615 | 1601 | dnl Set up the Atari Xbios driver | ||
1616 | 1602 | CheckAtariXbiosVideo() | ||
1617 | 1603 | { | ||
1618 | 1604 | AC_ARG_ENABLE(xbios, | ||
1619 | 1605 | AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]), | ||
1620 | 1606 | , enable_video_xbios=yes) | ||
1621 | 1607 | video_xbios=no | ||
1622 | 1608 | if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then | ||
1623 | 1609 | video_xbios=yes | ||
1624 | 1610 | AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS) | ||
1625 | 1611 | SOURCES="$SOURCES $srcdir/src/video/xbios/*.c" | ||
1626 | 1612 | have_video=yes | ||
1627 | 1613 | fi | ||
1628 | 1614 | } | ||
1629 | 1615 | |||
1630 | 1616 | dnl Set up the Atari Gem driver | ||
1631 | 1617 | CheckAtariGemVideo() | ||
1632 | 1618 | { | ||
1633 | 1619 | AC_ARG_ENABLE(gem, | ||
1634 | 1620 | AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]), | ||
1635 | 1621 | , enable_video_gem=yes) | ||
1636 | 1622 | if test x$enable_video = xyes -a x$enable_video_gem = xyes; then | ||
1637 | 1623 | video_gem=no | ||
1638 | 1624 | AC_CHECK_HEADER(gem.h, have_gem_hdr=yes) | ||
1639 | 1625 | AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes) | ||
1640 | 1626 | if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then | ||
1641 | 1627 | video_gem=yes | ||
1642 | 1628 | AC_DEFINE(SDL_VIDEO_DRIVER_GEM) | ||
1643 | 1629 | SOURCES="$SOURCES $srcdir/src/video/gem/*.c" | ||
1644 | 1630 | SDL_LIBS="$SDL_LIBS -lgem" | ||
1645 | 1631 | have_video=yes | ||
1646 | 1632 | fi | ||
1647 | 1633 | fi | ||
1648 | 1634 | } | ||
1649 | 1635 | |||
1650 | 1636 | dnl rcg04172001 Set up the Null video driver. | ||
1651 | 1637 | CheckDummyVideo() | ||
1652 | 1638 | { | ||
1653 | 1639 | AC_ARG_ENABLE(video-dummy, | ||
1654 | 1640 | AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]), | ||
1655 | 1641 | , enable_video_dummy=yes) | ||
1656 | 1642 | if test x$enable_video_dummy = xyes; then | ||
1657 | 1643 | AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY) | ||
1658 | 1644 | SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" | ||
1659 | 1645 | have_video=yes | ||
1660 | 1646 | fi | ||
1661 | 1647 | } | ||
1662 | 1648 | |||
1663 | 1649 | dnl Check to see if OpenGL support is desired | ||
1664 | 1650 | AC_ARG_ENABLE(video-opengl, | ||
1665 | 1651 | AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]), | ||
1666 | 1652 | , enable_video_opengl=yes) | ||
1667 | 1653 | |||
1668 | 1654 | dnl Find OpenGL | ||
1669 | 1655 | CheckOpenGLX11() | ||
1670 | 1656 | { | ||
1671 | 1657 | if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then | ||
1672 | 1658 | AC_MSG_CHECKING(for OpenGL (GLX) support) | ||
1673 | 1659 | video_opengl=no | ||
1674 | 1660 | AC_TRY_COMPILE([ | ||
1675 | 1661 | #include <GL/gl.h> | ||
1676 | 1662 | #include <GL/glx.h> | ||
1677 | 1663 | #include <GL/glu.h> | ||
1678 | 1664 | ],[ | ||
1679 | 1665 | ],[ | ||
1680 | 1666 | video_opengl=yes | ||
1681 | 1667 | ]) | ||
1682 | 1668 | AC_MSG_RESULT($video_opengl) | ||
1683 | 1669 | if test x$video_opengl = xyes; then | ||
1684 | 1670 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1685 | 1671 | AC_DEFINE(SDL_VIDEO_OPENGL_GLX) | ||
1686 | 1672 | fi | ||
1687 | 1673 | fi | ||
1688 | 1674 | } | ||
1689 | 1675 | |||
1690 | 1676 | dnl Find QNX RtP OpenGL | ||
1691 | 1677 | CheckOpenGLQNX() | ||
1692 | 1678 | { | ||
1693 | 1679 | if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then | ||
1694 | 1680 | AC_MSG_CHECKING(for OpenGL (Photon) support) | ||
1695 | 1681 | video_opengl=no | ||
1696 | 1682 | AC_TRY_COMPILE([ | ||
1697 | 1683 | #include <GL/gl.h> | ||
1698 | 1684 | ],[ | ||
1699 | 1685 | ],[ | ||
1700 | 1686 | video_opengl=yes | ||
1701 | 1687 | ]) | ||
1702 | 1688 | AC_MSG_RESULT($video_opengl) | ||
1703 | 1689 | if test x$video_opengl = xyes; then | ||
1704 | 1690 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1705 | 1691 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" | ||
1706 | 1692 | fi | ||
1707 | 1693 | fi | ||
1708 | 1694 | } | ||
1709 | 1695 | |||
1710 | 1696 | dnl Check for Win32 OpenGL | ||
1711 | 1697 | CheckWIN32GL() | ||
1712 | 1698 | { | ||
1713 | 1699 | if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then | ||
1714 | 1700 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1715 | 1701 | AC_DEFINE(SDL_VIDEO_OPENGL_WGL) | ||
1716 | 1702 | fi | ||
1717 | 1703 | } | ||
1718 | 1704 | |||
1719 | 1705 | dnl Check for BeOS OpenGL | ||
1720 | 1706 | CheckBeGL() | ||
1721 | 1707 | { | ||
1722 | 1708 | if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then | ||
1723 | 1709 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1724 | 1710 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" | ||
1725 | 1711 | fi | ||
1726 | 1712 | } | ||
1727 | 1713 | |||
1728 | 1714 | dnl Check for MacOS OpenGL | ||
1729 | 1715 | CheckMacGL() | ||
1730 | 1716 | { | ||
1731 | 1717 | if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then | ||
1732 | 1718 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1733 | 1719 | case "$host" in | ||
1734 | 1720 | *-*-darwin*) | ||
1735 | 1721 | if test x$enable_video_cocoa = xyes; then | ||
1736 | 1722 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL" | ||
1737 | 1723 | fi | ||
1738 | 1724 | if test x$enable_video_carbon = xyes; then | ||
1739 | 1725 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL" | ||
1740 | 1726 | fi | ||
1741 | 1727 | esac | ||
1742 | 1728 | fi | ||
1743 | 1729 | } | ||
1744 | 1730 | |||
1745 | 1731 | dnl Check for Mesa offscreen rendering | ||
1746 | 1732 | CheckAtariOSMesa() | ||
1747 | 1733 | { | ||
1748 | 1734 | if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then | ||
1749 | 1735 | AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes) | ||
1750 | 1736 | AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm) | ||
1751 | 1737 | |||
1752 | 1738 | # Static linking to -lOSMesa | ||
1753 | 1739 | AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no) | ||
1754 | 1740 | if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then | ||
1755 | 1741 | # -lOSMesa is really the static library | ||
1756 | 1742 | if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then | ||
1757 | 1743 | OSMESA_LIBS="-lOSMesa" | ||
1758 | 1744 | fi | ||
1759 | 1745 | else | ||
1760 | 1746 | # -lOSMesa is a loader for OSMesa.ldg | ||
1761 | 1747 | OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags` | ||
1762 | 1748 | OSMESA_LIBS=`$OSMESA_CONFIG --libs` | ||
1763 | 1749 | fi | ||
1764 | 1750 | AC_DEFINE(SDL_VIDEO_OPENGL) | ||
1765 | 1751 | AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA) | ||
1766 | 1752 | SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS" | ||
1767 | 1753 | SDL_LIBS="$SDL_LIBS $OSMESA_LIBS" | ||
1768 | 1754 | |||
1769 | 1755 | AC_ARG_ENABLE(osmesa-shared, | ||
1770 | 1756 | AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]), | ||
1771 | 1757 | , enable_osmesa_shared=yes) | ||
1772 | 1758 | if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then | ||
1773 | 1759 | # Dynamic linking | ||
1774 | 1760 | if test "x$have_osmesa_hdr" = "xyes"; then | ||
1775 | 1761 | AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC) | ||
1776 | 1762 | fi | ||
1777 | 1763 | fi | ||
1778 | 1764 | fi | ||
1779 | 1765 | } | ||
1780 | 1766 | |||
1781 | 1767 | AC_ARG_ENABLE(screensaver, | ||
1782 | 1768 | AC_HELP_STRING([--enable-screensaver], [enable screensaver by default while any SDL application is running [[default=no]]]), | ||
1783 | 1769 | , enable_screensaver=no) | ||
1784 | 1770 | if test x$enable_screensaver = xno; then | ||
1785 | 1771 | AC_DEFINE(SDL_VIDEO_DISABLE_SCREENSAVER) | ||
1786 | 1772 | fi | ||
1787 | 1773 | |||
1788 | 1774 | dnl See if we can use the new unified event interface in Linux 2.4 | ||
1789 | 1775 | CheckInputEvents() | ||
1790 | 1776 | { | ||
1791 | 1777 | dnl Check for Linux 2.4 unified input event interface support | ||
1792 | 1778 | AC_ARG_ENABLE(input-events, | ||
1793 | 1779 | AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]), | ||
1794 | 1780 | , enable_input_events=yes) | ||
1795 | 1781 | if test x$enable_input_events = xyes; then | ||
1796 | 1782 | AC_MSG_CHECKING(for Linux 2.4 unified input interface) | ||
1797 | 1783 | use_input_events=no | ||
1798 | 1784 | AC_TRY_COMPILE([ | ||
1799 | 1785 | #include <linux/input.h> | ||
1800 | 1786 | ],[ | ||
1801 | 1787 | #ifndef EVIOCGNAME | ||
1802 | 1788 | #error EVIOCGNAME() ioctl not available | ||
1803 | 1789 | #endif | ||
1804 | 1790 | ],[ | ||
1805 | 1791 | use_input_events=yes | ||
1806 | 1792 | ]) | ||
1807 | 1793 | AC_MSG_RESULT($use_input_events) | ||
1808 | 1794 | if test x$use_input_events = xyes; then | ||
1809 | 1795 | AC_DEFINE(SDL_INPUT_LINUXEV) | ||
1810 | 1796 | fi | ||
1811 | 1797 | fi | ||
1812 | 1798 | } | ||
1813 | 1799 | |||
1814 | 1800 | dnl See if we can use the Touchscreen input library | ||
1815 | 1801 | CheckTslib() | ||
1816 | 1802 | { | ||
1817 | 1803 | AC_ARG_ENABLE(input-tslib, | ||
1818 | 1804 | AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]), | ||
1819 | 1805 | , enable_input_tslib=yes) | ||
1820 | 1806 | if test x$enable_input_tslib = xyes; then | ||
1821 | 1807 | AC_MSG_CHECKING(for Touchscreen library support) | ||
1822 | 1808 | enable_input_tslib=no | ||
1823 | 1809 | AC_TRY_COMPILE([ | ||
1824 | 1810 | #include "tslib.h" | ||
1825 | 1811 | ],[ | ||
1826 | 1812 | ],[ | ||
1827 | 1813 | enable_input_tslib=yes | ||
1828 | 1814 | ]) | ||
1829 | 1815 | AC_MSG_RESULT($enable_input_tslib) | ||
1830 | 1816 | if test x$enable_input_tslib = xyes; then | ||
1831 | 1817 | AC_DEFINE(SDL_INPUT_TSLIB) | ||
1832 | 1818 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts" | ||
1833 | 1819 | fi | ||
1834 | 1820 | fi | ||
1835 | 1821 | } | ||
1836 | 1822 | |||
1837 | 1823 | dnl See if we can use GNU pth library for threads | ||
1838 | 1824 | CheckPTH() | ||
1839 | 1825 | { | ||
1840 | 1826 | dnl Check for pth support | ||
1841 | 1827 | AC_ARG_ENABLE(pth, | ||
1842 | 1828 | AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]), | ||
1843 | 1829 | , enable_pth=yes) | ||
1844 | 1830 | if test x$enable_threads = xyes -a x$enable_pth = xyes; then | ||
1845 | 1831 | AC_PATH_PROG(PTH_CONFIG, pth-config, no) | ||
1846 | 1832 | if test "$PTH_CONFIG" = "no"; then | ||
1847 | 1833 | use_pth=no | ||
1848 | 1834 | else | ||
1849 | 1835 | use_pth=yes | ||
1850 | 1836 | fi | ||
1851 | 1837 | AC_MSG_CHECKING(pth) | ||
1852 | 1838 | AC_MSG_RESULT($use_pth) | ||
1853 | 1839 | if test "x$use_pth" = xyes; then | ||
1854 | 1840 | AC_DEFINE(SDL_THREAD_PTH) | ||
1855 | 1841 | SOURCES="$SOURCES $srcdir/src/thread/pth/*.c" | ||
1856 | 1842 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c" | ||
1857 | 1843 | SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`" | ||
1858 | 1844 | SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`" | ||
1859 | 1845 | have_threads=yes | ||
1860 | 1846 | fi | ||
1861 | 1847 | fi | ||
1862 | 1848 | } | ||
1863 | 1849 | |||
1864 | 1850 | dnl See what type of thread model to use on Linux and Solaris | ||
1865 | 1851 | CheckPTHREAD() | ||
1866 | 1852 | { | ||
1867 | 1853 | dnl Check for pthread support | ||
1868 | 1854 | AC_ARG_ENABLE(pthreads, | ||
1869 | 1855 | AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]), | ||
1870 | 1856 | , enable_pthreads=yes) | ||
1871 | 1857 | dnl This is used on Linux for glibc binary compatibility (Doh!) | ||
1872 | 1858 | AC_ARG_ENABLE(pthread-sem, | ||
1873 | 1859 | AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), | ||
1874 | 1860 | , enable_pthread_sem=yes) | ||
1875 | 1861 | case "$host" in | ||
1876 | 1862 | *-*-linux*|*-*-uclinux*) | ||
1877 | 1863 | pthread_cflags="-D_REENTRANT" | ||
1878 | 1864 | pthread_lib="-lpthread" | ||
1879 | 1865 | ;; | ||
1880 | 1866 | *-*-bsdi*) | ||
1881 | 1867 | pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" | ||
1882 | 1868 | pthread_lib="" | ||
1883 | 1869 | ;; | ||
1884 | 1870 | *-*-darwin*) | ||
1885 | 1871 | pthread_cflags="-D_THREAD_SAFE" | ||
1886 | 1872 | # causes Carbon.p complaints? | ||
1887 | 1873 | # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" | ||
1888 | 1874 | ;; | ||
1889 | 1875 | *-*-freebsd*|*-*-dragonfly*) | ||
1890 | 1876 | pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" | ||
1891 | 1877 | pthread_lib="-pthread" | ||
1892 | 1878 | ;; | ||
1893 | 1879 | *-*-netbsd*) | ||
1894 | 1880 | pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" | ||
1895 | 1881 | pthread_lib="-lpthread" | ||
1896 | 1882 | ;; | ||
1897 | 1883 | *-*-openbsd*) | ||
1898 | 1884 | pthread_cflags="-D_REENTRANT" | ||
1899 | 1885 | pthread_lib="-pthread" | ||
1900 | 1886 | ;; | ||
1901 | 1887 | *-*-solaris*) | ||
1902 | 1888 | pthread_cflags="-D_REENTRANT" | ||
1903 | 1889 | pthread_lib="-lpthread -lposix4" | ||
1904 | 1890 | ;; | ||
1905 | 1891 | *-*-sysv5*) | ||
1906 | 1892 | pthread_cflags="-D_REENTRANT -Kthread" | ||
1907 | 1893 | pthread_lib="" | ||
1908 | 1894 | ;; | ||
1909 | 1895 | *-*-irix*) | ||
1910 | 1896 | pthread_cflags="-D_SGI_MP_SOURCE" | ||
1911 | 1897 | pthread_lib="-lpthread" | ||
1912 | 1898 | ;; | ||
1913 | 1899 | *-*-aix*) | ||
1914 | 1900 | pthread_cflags="-D_REENTRANT -mthreads" | ||
1915 | 1901 | pthread_lib="-lpthread" | ||
1916 | 1902 | ;; | ||
1917 | 1903 | *-*-hpux11*) | ||
1918 | 1904 | pthread_cflags="-D_REENTRANT" | ||
1919 | 1905 | pthread_lib="-L/usr/lib -lpthread" | ||
1920 | 1906 | ;; | ||
1921 | 1907 | *-*-qnx*) | ||
1922 | 1908 | pthread_cflags="" | ||
1923 | 1909 | pthread_lib="" | ||
1924 | 1910 | ;; | ||
1925 | 1911 | *-*-osf*) | ||
1926 | 1912 | pthread_cflags="-D_REENTRANT" | ||
1927 | 1913 | if test x$ac_cv_prog_gcc = xyes; then | ||
1928 | 1914 | pthread_lib="-lpthread -lrt" | ||
1929 | 1915 | else | ||
1930 | 1916 | pthread_lib="-lpthread -lexc -lrt" | ||
1931 | 1917 | fi | ||
1932 | 1918 | ;; | ||
1933 | 1919 | *) | ||
1934 | 1920 | pthread_cflags="-D_REENTRANT" | ||
1935 | 1921 | pthread_lib="-lpthread" | ||
1936 | 1922 | ;; | ||
1937 | 1923 | esac | ||
1938 | 1924 | if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then | ||
1939 | 1925 | # Save the original compiler flags and libraries | ||
1940 | 1926 | ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" | ||
1941 | 1927 | # Add the pthread compiler flags and libraries | ||
1942 | 1928 | CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" | ||
1943 | 1929 | # Check to see if we have pthread support on this system | ||
1944 | 1930 | AC_MSG_CHECKING(for pthreads) | ||
1945 | 1931 | use_pthreads=no | ||
1946 | 1932 | AC_TRY_LINK([ | ||
1947 | 1933 | #include <pthread.h> | ||
1948 | 1934 | ],[ | ||
1949 | 1935 | pthread_attr_t type; | ||
1950 | 1936 | pthread_attr_init(&type); | ||
1951 | 1937 | ],[ | ||
1952 | 1938 | use_pthreads=yes | ||
1953 | 1939 | ]) | ||
1954 | 1940 | AC_MSG_RESULT($use_pthreads) | ||
1955 | 1941 | # Restore the compiler flags and libraries | ||
1956 | 1942 | CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" | ||
1957 | 1943 | |||
1958 | 1944 | # Do futher testing if we have pthread support... | ||
1959 | 1945 | if test x$use_pthreads = xyes; then | ||
1960 | 1946 | AC_DEFINE(SDL_THREAD_PTHREAD) | ||
1961 | 1947 | EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags" | ||
1962 | 1948 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib" | ||
1963 | 1949 | SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags" | ||
1964 | 1950 | SDL_LIBS="$SDL_LIBS $pthread_lib" | ||
1965 | 1951 | |||
1966 | 1952 | # Save the original compiler flags and libraries | ||
1967 | 1953 | ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" | ||
1968 | 1954 | # Add the pthread compiler flags and libraries | ||
1969 | 1955 | CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" | ||
1970 | 1956 | |||
1971 | 1957 | # Check to see if recursive mutexes are available | ||
1972 | 1958 | AC_MSG_CHECKING(for recursive mutexes) | ||
1973 | 1959 | has_recursive_mutexes=no | ||
1974 | 1960 | if test x$has_recursive_mutexes = xno; then | ||
1975 | 1961 | AC_TRY_COMPILE([ | ||
1976 | 1962 | #include <pthread.h> | ||
1977 | 1963 | ],[ | ||
1978 | 1964 | pthread_mutexattr_t attr; | ||
1979 | 1965 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); | ||
1980 | 1966 | ],[ | ||
1981 | 1967 | has_recursive_mutexes=yes | ||
1982 | 1968 | AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX) | ||
1983 | 1969 | ]) | ||
1984 | 1970 | fi | ||
1985 | 1971 | if test x$has_recursive_mutexes = xno; then | ||
1986 | 1972 | AC_TRY_COMPILE([ | ||
1987 | 1973 | #include <pthread.h> | ||
1988 | 1974 | ],[ | ||
1989 | 1975 | pthread_mutexattr_t attr; | ||
1990 | 1976 | pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); | ||
1991 | 1977 | ],[ | ||
1992 | 1978 | has_recursive_mutexes=yes | ||
1993 | 1979 | AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP) | ||
1994 | 1980 | ]) | ||
1995 | 1981 | fi | ||
1996 | 1982 | AC_MSG_RESULT($has_recursive_mutexes) | ||
1997 | 1983 | |||
1998 | 1984 | # Check to see if pthread semaphore support is missing | ||
1999 | 1985 | if test x$enable_pthread_sem = xyes; then | ||
2000 | 1986 | AC_MSG_CHECKING(for pthread semaphores) | ||
2001 | 1987 | have_pthread_sem=no | ||
2002 | 1988 | AC_TRY_COMPILE([ | ||
2003 | 1989 | #include <pthread.h> | ||
2004 | 1990 | #include <semaphore.h> | ||
2005 | 1991 | ],[ | ||
2006 | 1992 | ],[ | ||
2007 | 1993 | have_pthread_sem=yes | ||
2008 | 1994 | ]) | ||
2009 | 1995 | AC_MSG_RESULT($have_pthread_sem) | ||
2010 | 1996 | fi | ||
2011 | 1997 | if test x$have_pthread_sem = xyes; then | ||
2012 | 1998 | AC_MSG_CHECKING(for sem_timedwait) | ||
2013 | 1999 | have_sem_timedwait=no | ||
2014 | 2000 | AC_TRY_LINK([ | ||
2015 | 2001 | #include <pthread.h> | ||
2016 | 2002 | #include <semaphore.h> | ||
2017 | 2003 | ],[ | ||
2018 | 2004 | sem_timedwait(NULL, NULL); | ||
2019 | 2005 | ],[ | ||
2020 | 2006 | have_sem_timedwait=yes | ||
2021 | 2007 | AC_DEFINE(HAVE_SEM_TIMEDWAIT) | ||
2022 | 2008 | ]) | ||
2023 | 2009 | AC_MSG_RESULT($have_sem_timedwait) | ||
2024 | 2010 | fi | ||
2025 | 2011 | |||
2026 | 2012 | # Restore the compiler flags and libraries | ||
2027 | 2013 | CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" | ||
2028 | 2014 | |||
2029 | 2015 | # Basic thread creation functions | ||
2030 | 2016 | SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c" | ||
2031 | 2017 | |||
2032 | 2018 | # Semaphores | ||
2033 | 2019 | # We can fake these with mutexes and condition variables if necessary | ||
2034 | 2020 | if test x$have_pthread_sem = xyes; then | ||
2035 | 2021 | SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c" | ||
2036 | 2022 | else | ||
2037 | 2023 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c" | ||
2038 | 2024 | fi | ||
2039 | 2025 | |||
2040 | 2026 | # Mutexes | ||
2041 | 2027 | # We can fake these with semaphores if necessary | ||
2042 | 2028 | SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c" | ||
2043 | 2029 | |||
2044 | 2030 | # Condition variables | ||
2045 | 2031 | # We can fake these with semaphores and mutexes if necessary | ||
2046 | 2032 | SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c" | ||
2047 | 2033 | |||
2048 | 2034 | have_threads=yes | ||
2049 | 2035 | else | ||
2050 | 2036 | CheckPTH | ||
2051 | 2037 | fi | ||
2052 | 2038 | fi | ||
2053 | 2039 | } | ||
2054 | 2040 | |||
2055 | 2041 | dnl Determine whether the compiler can produce Win32 executables | ||
2056 | 2042 | CheckWIN32() | ||
2057 | 2043 | { | ||
2058 | 2044 | AC_MSG_CHECKING(Win32 compiler) | ||
2059 | 2045 | have_win32_gcc=no | ||
2060 | 2046 | AC_TRY_COMPILE([ | ||
2061 | 2047 | #include <windows.h> | ||
2062 | 2048 | ],[ | ||
2063 | 2049 | ],[ | ||
2064 | 2050 | have_win32_gcc=yes | ||
2065 | 2051 | ]) | ||
2066 | 2052 | AC_MSG_RESULT($have_win32_gcc) | ||
2067 | 2053 | if test x$have_win32_gcc != xyes; then | ||
2068 | 2054 | AC_MSG_ERROR([ | ||
2069 | 2055 | *** Your compiler ($CC) does not produce Win32 executables! | ||
2070 | 2056 | ]) | ||
2071 | 2057 | fi | ||
2072 | 2058 | |||
2073 | 2059 | dnl See if the user wants to redirect standard output to files | ||
2074 | 2060 | AC_ARG_ENABLE(stdio-redirect, | ||
2075 | 2061 | AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]), | ||
2076 | 2062 | , enable_stdio_redirect=yes) | ||
2077 | 2063 | if test x$enable_stdio_redirect != xyes; then | ||
2078 | 2064 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT" | ||
2079 | 2065 | fi | ||
2080 | 2066 | |||
2081 | 2067 | if test x$enable_video = xyes; then | ||
2082 | 2068 | AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB) | ||
2083 | 2069 | SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c" | ||
2084 | 2070 | SOURCES="$SOURCES $srcdir/src/video/windib/*.c" | ||
2085 | 2071 | have_video=yes | ||
2086 | 2072 | fi | ||
2087 | 2073 | } | ||
2088 | 2074 | |||
2089 | 2075 | dnl Find the DirectX includes and libraries | ||
2090 | 2076 | CheckDIRECTX() | ||
2091 | 2077 | { | ||
2092 | 2078 | AC_ARG_ENABLE(directx, | ||
2093 | 2079 | AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]), | ||
2094 | 2080 | , enable_directx=yes) | ||
2095 | 2081 | if test x$enable_directx = xyes; then | ||
2096 | 2082 | have_directx=no | ||
2097 | 2083 | AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) | ||
2098 | 2084 | AC_CHECK_HEADER(dsound.h, have_dsound=yes) | ||
2099 | 2085 | AC_CHECK_HEADER(dinput.h, use_dinput=yes) | ||
2100 | 2086 | if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then | ||
2101 | 2087 | have_directx=yes | ||
2102 | 2088 | fi | ||
2103 | 2089 | if test x$enable_video = xyes -a x$have_directx = xyes; then | ||
2104 | 2090 | AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW) | ||
2105 | 2091 | SOURCES="$SOURCES $srcdir/src/video/windx5/*.c" | ||
2106 | 2092 | have_video=yes | ||
2107 | 2093 | fi | ||
2108 | 2094 | fi | ||
2109 | 2095 | } | ||
2110 | 2096 | |||
2111 | 2097 | dnl Check for the dlfcn.h interface for dynamically loading objects | ||
2112 | 2098 | CheckDLOPEN() | ||
2113 | 2099 | { | ||
2114 | 2100 | AC_ARG_ENABLE(sdl-dlopen, | ||
2115 | 2101 | AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]), | ||
2116 | 2102 | , enable_sdl_dlopen=yes) | ||
2117 | 2103 | if test x$enable_sdl_dlopen = xyes; then | ||
2118 | 2104 | AC_MSG_CHECKING(for dlopen) | ||
2119 | 2105 | have_dlopen=no | ||
2120 | 2106 | AC_TRY_COMPILE([ | ||
2121 | 2107 | #include <dlfcn.h> | ||
2122 | 2108 | ],[ | ||
2123 | 2109 | #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020 | ||
2124 | 2110 | #error Use dlcompat for Mac OS X 10.2 compatibility | ||
2125 | 2111 | #endif | ||
2126 | 2112 | ],[ | ||
2127 | 2113 | have_dlopen=yes | ||
2128 | 2114 | ]) | ||
2129 | 2115 | AC_MSG_RESULT($have_dlopen) | ||
2130 | 2116 | |||
2131 | 2117 | if test x$have_dlopen = xyes; then | ||
2132 | 2118 | AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS", | ||
2133 | 2119 | AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl", | ||
2134 | 2120 | AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl"))) | ||
2135 | 2121 | AC_DEFINE(SDL_LOADSO_DLOPEN) | ||
2136 | 2122 | SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" | ||
2137 | 2123 | have_loadso=yes | ||
2138 | 2124 | fi | ||
2139 | 2125 | fi | ||
2140 | 2126 | } | ||
2141 | 2127 | |||
2142 | 2128 | dnl Set up the Atari LDG (shared object loader) | ||
2143 | 2129 | CheckAtariLdg() | ||
2144 | 2130 | { | ||
2145 | 2131 | AC_ARG_ENABLE(atari-ldg, | ||
2146 | 2132 | AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]), | ||
2147 | 2133 | , enable_atari_ldg=yes) | ||
2148 | 2134 | if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then | ||
2149 | 2135 | AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes) | ||
2150 | 2136 | AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem) | ||
2151 | 2137 | if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then | ||
2152 | 2138 | AC_DEFINE(SDL_LOADSO_LDG) | ||
2153 | 2139 | SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c" | ||
2154 | 2140 | SDL_LIBS="$SDL_LIBS -lldg -lgem" | ||
2155 | 2141 | have_loadso=yes | ||
2156 | 2142 | fi | ||
2157 | 2143 | fi | ||
2158 | 2144 | } | ||
2159 | 2145 | |||
2160 | 2146 | dnl Check for the usbhid(3) library on *BSD | ||
2161 | 2147 | CheckUSBHID() | ||
2162 | 2148 | { | ||
2163 | 2149 | if test x$enable_joystick = xyes; then | ||
2164 | 2150 | AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes) | ||
2165 | 2151 | if test x$have_libusbhid = xyes; then | ||
2166 | 2152 | AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"]) | ||
2167 | 2153 | AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"]) | ||
2168 | 2154 | USB_LIBS="$USB_LIBS -lusbhid" | ||
2169 | 2155 | else | ||
2170 | 2156 | AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"]) | ||
2171 | 2157 | AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"]) | ||
2172 | 2158 | AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"]) | ||
2173 | 2159 | fi | ||
2174 | 2160 | |||
2175 | 2161 | save_CFLAGS="$CFLAGS" | ||
2176 | 2162 | CFLAGS="$CFLAGS $USB_CFLAGS" | ||
2177 | 2163 | |||
2178 | 2164 | AC_MSG_CHECKING(for usbhid) | ||
2179 | 2165 | have_usbhid=no | ||
2180 | 2166 | AC_TRY_COMPILE([ | ||
2181 | 2167 | #include <sys/types.h> | ||
2182 | 2168 | #if defined(HAVE_USB_H) | ||
2183 | 2169 | #include <usb.h> | ||
2184 | 2170 | #endif | ||
2185 | 2171 | #ifdef __DragonFly__ | ||
2186 | 2172 | # include <bus/usb/usb.h> | ||
2187 | 2173 | # include <bus/usb/usbhid.h> | ||
2188 | 2174 | #else | ||
2189 | 2175 | # include <dev/usb/usb.h> | ||
2190 | 2176 | # include <dev/usb/usbhid.h> | ||
2191 | 2177 | #endif | ||
2192 | 2178 | #if defined(HAVE_USBHID_H) | ||
2193 | 2179 | #include <usbhid.h> | ||
2194 | 2180 | #elif defined(HAVE_LIBUSB_H) | ||
2195 | 2181 | #include <libusb.h> | ||
2196 | 2182 | #elif defined(HAVE_LIBUSBHID_H) | ||
2197 | 2183 | #include <libusbhid.h> | ||
2198 | 2184 | #endif | ||
2199 | 2185 | ],[ | ||
2200 | 2186 | struct report_desc *repdesc; | ||
2201 | 2187 | struct usb_ctl_report *repbuf; | ||
2202 | 2188 | hid_kind_t hidkind; | ||
2203 | 2189 | ],[ | ||
2204 | 2190 | have_usbhid=yes | ||
2205 | 2191 | ]) | ||
2206 | 2192 | AC_MSG_RESULT($have_usbhid) | ||
2207 | 2193 | |||
2208 | 2194 | if test x$have_usbhid = xyes; then | ||
2209 | 2195 | AC_MSG_CHECKING(for ucr_data member of usb_ctl_report) | ||
2210 | 2196 | have_usbhid_ucr_data=no | ||
2211 | 2197 | AC_TRY_COMPILE([ | ||
2212 | 2198 | #include <sys/types.h> | ||
2213 | 2199 | #if defined(HAVE_USB_H) | ||
2214 | 2200 | #include <usb.h> | ||
2215 | 2201 | #endif | ||
2216 | 2202 | #ifdef __DragonFly__ | ||
2217 | 2203 | # include <bus/usb/usb.h> | ||
2218 | 2204 | # include <bus/usb/usbhid.h> | ||
2219 | 2205 | #else | ||
2220 | 2206 | # include <dev/usb/usb.h> | ||
2221 | 2207 | # include <dev/usb/usbhid.h> | ||
2222 | 2208 | #endif | ||
2223 | 2209 | #if defined(HAVE_USBHID_H) | ||
2224 | 2210 | #include <usbhid.h> | ||
2225 | 2211 | #elif defined(HAVE_LIBUSB_H) | ||
2226 | 2212 | #include <libusb.h> | ||
2227 | 2213 | #elif defined(HAVE_LIBUSBHID_H) | ||
2228 | 2214 | #include <libusbhid.h> | ||
2229 | 2215 | #endif | ||
2230 | 2216 | ],[ | ||
2231 | 2217 | struct usb_ctl_report buf; | ||
2232 | 2218 | if (buf.ucr_data) { } | ||
2233 | 2219 | ],[ | ||
2234 | 2220 | have_usbhid_ucr_data=yes | ||
2235 | 2221 | ]) | ||
2236 | 2222 | if test x$have_usbhid_ucr_data = xyes; then | ||
2237 | 2223 | USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" | ||
2238 | 2224 | fi | ||
2239 | 2225 | AC_MSG_RESULT($have_usbhid_ucr_data) | ||
2240 | 2226 | |||
2241 | 2227 | AC_MSG_CHECKING(for new usbhid API) | ||
2242 | 2228 | have_usbhid_new=no | ||
2243 | 2229 | AC_TRY_COMPILE([ | ||
2244 | 2230 | #include <sys/types.h> | ||
2245 | 2231 | #if defined(HAVE_USB_H) | ||
2246 | 2232 | #include <usb.h> | ||
2247 | 2233 | #endif | ||
2248 | 2234 | #ifdef __DragonFly__ | ||
2249 | 2235 | #include <bus/usb/usb.h> | ||
2250 | 2236 | #include <bus/usb/usbhid.h> | ||
2251 | 2237 | #else | ||
2252 | 2238 | #include <dev/usb/usb.h> | ||
2253 | 2239 | #include <dev/usb/usbhid.h> | ||
2254 | 2240 | #endif | ||
2255 | 2241 | #if defined(HAVE_USBHID_H) | ||
2256 | 2242 | #include <usbhid.h> | ||
2257 | 2243 | #elif defined(HAVE_LIBUSB_H) | ||
2258 | 2244 | #include <libusb.h> | ||
2259 | 2245 | #elif defined(HAVE_LIBUSBHID_H) | ||
2260 | 2246 | #include <libusbhid.h> | ||
2261 | 2247 | #endif | ||
2262 | 2248 | ],[ | ||
2263 | 2249 | report_desc_t d; | ||
2264 | 2250 | hid_start_parse(d, 1, 1); | ||
2265 | 2251 | ],[ | ||
2266 | 2252 | have_usbhid_new=yes | ||
2267 | 2253 | ]) | ||
2268 | 2254 | if test x$have_usbhid_new = xyes; then | ||
2269 | 2255 | USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" | ||
2270 | 2256 | fi | ||
2271 | 2257 | AC_MSG_RESULT($have_usbhid_new) | ||
2272 | 2258 | |||
2273 | 2259 | AC_MSG_CHECKING(for struct joystick in machine/joystick.h) | ||
2274 | 2260 | have_machine_joystick=no | ||
2275 | 2261 | AC_TRY_COMPILE([ | ||
2276 | 2262 | #include <machine/joystick.h> | ||
2277 | 2263 | ],[ | ||
2278 | 2264 | struct joystick t; | ||
2279 | 2265 | ],[ | ||
2280 | 2266 | have_machine_joystick=yes | ||
2281 | 2267 | ]) | ||
2282 | 2268 | if test x$have_machine_joystick = xyes; then | ||
2283 | 2269 | AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H) | ||
2284 | 2270 | fi | ||
2285 | 2271 | AC_MSG_RESULT($have_machine_joystick) | ||
2286 | 2272 | |||
2287 | 2273 | AC_DEFINE(SDL_JOYSTICK_USBHID) | ||
2288 | 2274 | SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" | ||
2289 | 2275 | EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" | ||
2290 | 2276 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS" | ||
2291 | 2277 | have_joystick=yes | ||
2292 | 2278 | fi | ||
2293 | 2279 | CFLAGS="$save_CFLAGS" | ||
2294 | 2280 | fi | ||
2295 | 2281 | } | ||
2296 | 2282 | |||
2297 | 2283 | dnl Check for clock_gettime() | ||
2298 | 2284 | CheckClockGettime() | ||
2299 | 2285 | { | ||
2300 | 2286 | AC_ARG_ENABLE(clock_gettime, | ||
2301 | 2287 | AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]), | ||
2302 | 2288 | , enable_clock_gettime=no) | ||
2303 | 2289 | if test x$enable_clock_gettime = xyes; then | ||
2304 | 2290 | AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes) | ||
2305 | 2291 | if test x$have_clock_gettime = xyes; then | ||
2306 | 2292 | AC_DEFINE(HAVE_CLOCK_GETTIME) | ||
2307 | 2293 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" | ||
2308 | 2294 | fi | ||
2309 | 2295 | fi | ||
2310 | 2296 | } | ||
2311 | 2297 | |||
2312 | 2298 | dnl Check for a valid linux/version.h | ||
2313 | 2299 | CheckLinuxVersion() | ||
2314 | 2300 | { | ||
2315 | 2301 | AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes) | ||
2316 | 2302 | if test x$have_linux_version_h = xyes; then | ||
2317 | 2303 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H" | ||
2318 | 2304 | fi | ||
2319 | 2305 | } | ||
2320 | 2306 | |||
2321 | 2307 | dnl Check if we want to use RPATH | ||
2322 | 2308 | CheckRPATH() | ||
2323 | 2309 | { | ||
2324 | 2310 | AC_ARG_ENABLE(rpath, | ||
2325 | 2311 | AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]), | ||
2326 | 2312 | , enable_rpath=yes) | ||
2327 | 2313 | } | ||
2328 | 2314 | |||
2329 | 2315 | dnl Set up the configuration based on the host platform! | ||
2330 | 2316 | case "$host" in | ||
2331 | 2317 | arm-*-elf*) # FIXME: Can we get more specific for iPodLinux? | ||
2332 | 2318 | ARCH=linux | ||
2333 | 2319 | CheckDummyVideo | ||
2334 | 2320 | CheckIPod | ||
2335 | 2321 | # Set up files for the timer library | ||
2336 | 2322 | if test x$enable_timers = xyes; then | ||
2337 | 2323 | AC_DEFINE(SDL_TIMER_UNIX) | ||
2338 | 2324 | SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" | ||
2339 | 2325 | have_timers=yes | ||
2340 | 2326 | fi | ||
2341 | 2327 | ;; | ||
2342 | 2328 | *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*) | ||
2343 | 2329 | case "$host" in | ||
2344 | 2330 | *-*-linux*) ARCH=linux ;; | ||
2345 | 2331 | *-*-uclinux*) ARCH=linux ;; | ||
2346 | 2332 | *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;; | ||
2347 | 2333 | *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;; | ||
2348 | 2334 | *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;; | ||
2349 | 2335 | *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants | ||
2350 | 2336 | *-*-bsdi*) ARCH=bsdi ;; | ||
2351 | 2337 | *-*-freebsd*) ARCH=freebsd ;; | ||
2352 | 2338 | *-*-dragonfly*) ARCH=freebsd ;; | ||
2353 | 2339 | *-*-netbsd*) ARCH=netbsd ;; | ||
2354 | 2340 | *-*-openbsd*) ARCH=openbsd ;; | ||
2355 | 2341 | *-*-sysv5*) ARCH=sysv5 ;; | ||
2356 | 2342 | *-*-solaris*) ARCH=solaris ;; | ||
2357 | 2343 | *-*-hpux*) ARCH=hpux ;; | ||
2358 | 2344 | *-*-irix*) ARCH=irix ;; | ||
2359 | 2345 | *-*-aix*) ARCH=aix ;; | ||
2360 | 2346 | *-*-osf*) ARCH=osf ;; | ||
2361 | 2347 | esac | ||
2362 | 2348 | CheckVisibilityHidden | ||
2363 | 2349 | CheckDummyVideo | ||
2364 | 2350 | CheckDiskAudio | ||
2365 | 2351 | CheckDummyAudio | ||
2366 | 2352 | CheckDLOPEN | ||
2367 | 2353 | CheckNASM | ||
2368 | 2354 | CheckAltivec | ||
2369 | 2355 | CheckOSS | ||
2370 | 2356 | CheckDMEDIA | ||
2371 | 2357 | CheckMME | ||
2372 | 2358 | CheckALSA | ||
2373 | 2359 | CheckARTSC | ||
2374 | 2360 | CheckESD | ||
2375 | 2361 | CheckPulseAudio | ||
2376 | 2362 | CheckNAS | ||
2377 | 2363 | CheckX11 | ||
2378 | 2364 | CheckNANOX | ||
2379 | 2365 | CheckFBCON | ||
2380 | 2366 | CheckDirectFB | ||
2381 | 2367 | CheckPS2GS | ||
2382 | 2368 | CheckPS3 | ||
2383 | 2369 | CheckGGI | ||
2384 | 2370 | CheckSVGA | ||
2385 | 2371 | CheckVGL | ||
2386 | 2372 | CheckWscons | ||
2387 | 2373 | CheckAAlib | ||
2388 | 2374 | CheckCaca | ||
2389 | 2375 | CheckQtopia | ||
2390 | 2376 | CheckPicoGUI | ||
2391 | 2377 | CheckOpenGLX11 | ||
2392 | 2378 | CheckInputEvents | ||
2393 | 2379 | CheckTslib | ||
2394 | 2380 | CheckUSBHID | ||
2395 | 2381 | CheckPTHREAD | ||
2396 | 2382 | CheckClockGettime | ||
2397 | 2383 | CheckLinuxVersion | ||
2398 | 2384 | CheckRPATH | ||
2399 | 2385 | # Set up files for the audio library | ||
2400 | 2386 | if test x$enable_audio = xyes; then | ||
2401 | 2387 | case $ARCH in | ||
2402 | 2388 | sysv5|solaris|hpux) | ||
2403 | 2389 | AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO) | ||
2404 | 2390 | SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" | ||
2405 | 2391 | have_audio=yes | ||
2406 | 2392 | ;; | ||
2407 | 2393 | netbsd|openbsd) | ||
2408 | 2394 | AC_DEFINE(SDL_AUDIO_DRIVER_BSD) | ||
2409 | 2395 | SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" | ||
2410 | 2396 | have_audio=yes | ||
2411 | 2397 | ;; | ||
2412 | 2398 | aix) | ||
2413 | 2399 | AC_DEFINE(SDL_AUDIO_DRIVER_PAUD) | ||
2414 | 2400 | SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" | ||
2415 | 2401 | have_audio=yes | ||
2416 | 2402 | ;; | ||
2417 | 2403 | esac | ||
2418 | 2404 | fi | ||
2419 | 2405 | # Set up files for the joystick library | ||
2420 | 2406 | if test x$enable_joystick = xyes; then | ||
2421 | 2407 | case $ARCH in | ||
2422 | 2408 | linux) | ||
2423 | 2409 | AC_DEFINE(SDL_JOYSTICK_LINUX) | ||
2424 | 2410 | SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" | ||
2425 | 2411 | have_joystick=yes | ||
2426 | 2412 | ;; | ||
2427 | 2413 | esac | ||
2428 | 2414 | fi | ||
2429 | 2415 | # Set up files for the cdrom library | ||
2430 | 2416 | if test x$enable_cdrom = xyes; then | ||
2431 | 2417 | case $ARCH in | ||
2432 | 2418 | linux|solaris) | ||
2433 | 2419 | AC_DEFINE(SDL_CDROM_LINUX) | ||
2434 | 2420 | SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c" | ||
2435 | 2421 | have_cdrom=yes | ||
2436 | 2422 | ;; | ||
2437 | 2423 | *freebsd*) | ||
2438 | 2424 | AC_DEFINE(SDL_CDROM_FREEBSD) | ||
2439 | 2425 | SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c" | ||
2440 | 2426 | have_cdrom=yes | ||
2441 | 2427 | ;; | ||
2442 | 2428 | *openbsd*|*netbsd*) | ||
2443 | 2429 | AC_DEFINE(SDL_CDROM_OPENBSD) | ||
2444 | 2430 | SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c" | ||
2445 | 2431 | have_cdrom=yes | ||
2446 | 2432 | ;; | ||
2447 | 2433 | bsdi) | ||
2448 | 2434 | AC_DEFINE(SDL_CDROM_BSDI) | ||
2449 | 2435 | SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c" | ||
2450 | 2436 | have_cdrom=yes | ||
2451 | 2437 | ;; | ||
2452 | 2438 | aix) | ||
2453 | 2439 | AC_DEFINE(SDL_CDROM_AIX) | ||
2454 | 2440 | SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c" | ||
2455 | 2441 | have_cdrom=yes | ||
2456 | 2442 | ;; | ||
2457 | 2443 | osf) | ||
2458 | 2444 | AC_DEFINE(SDL_CDROM_OSF) | ||
2459 | 2445 | SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c" | ||
2460 | 2446 | have_cdrom=yes | ||
2461 | 2447 | ;; | ||
2462 | 2448 | esac | ||
2463 | 2449 | fi | ||
2464 | 2450 | # Set up files for the thread library | ||
2465 | 2451 | if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then | ||
2466 | 2452 | AC_DEFINE(SDL_THREAD_SPROC) | ||
2467 | 2453 | SOURCES="$SOURCES $srcdir/src/thread/irix/*.c" | ||
2468 | 2454 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c" | ||
2469 | 2455 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" | ||
2470 | 2456 | have_threads=yes | ||
2471 | 2457 | fi | ||
2472 | 2458 | # Set up files for the timer library | ||
2473 | 2459 | if test x$enable_timers = xyes; then | ||
2474 | 2460 | AC_DEFINE(SDL_TIMER_UNIX) | ||
2475 | 2461 | SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" | ||
2476 | 2462 | have_timers=yes | ||
2477 | 2463 | fi | ||
2478 | 2464 | ;; | ||
2479 | 2465 | *-*-qnx*) | ||
2480 | 2466 | ARCH=qnx | ||
2481 | 2467 | CheckDummyVideo | ||
2482 | 2468 | CheckDiskAudio | ||
2483 | 2469 | CheckDummyAudio | ||
2484 | 2470 | # CheckNASM | ||
2485 | 2471 | CheckDLOPEN | ||
2486 | 2472 | CheckNAS | ||
2487 | 2473 | CheckPHOTON | ||
2488 | 2474 | CheckX11 | ||
2489 | 2475 | CheckOpenGLX11 | ||
2490 | 2476 | CheckPTHREAD | ||
2491 | 2477 | # Set up files for the audio library | ||
2492 | 2478 | if test x$enable_audio = xyes; then | ||
2493 | 2479 | AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO) | ||
2494 | 2480 | SOURCES="$SOURCES $srcdir/src/audio/nto/*.c" | ||
2495 | 2481 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" | ||
2496 | 2482 | have_audio=yes | ||
2497 | 2483 | fi | ||
2498 | 2484 | # Set up files for the cdrom library | ||
2499 | 2485 | if test x$enable_cdrom = xyes; then | ||
2500 | 2486 | AC_DEFINE(SDL_CDROM_QNX) | ||
2501 | 2487 | SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c" | ||
2502 | 2488 | have_cdrom=yes | ||
2503 | 2489 | fi | ||
2504 | 2490 | # Set up files for the timer library | ||
2505 | 2491 | if test x$enable_timers = xyes; then | ||
2506 | 2492 | AC_DEFINE(SDL_TIMER_UNIX) | ||
2507 | 2493 | SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" | ||
2508 | 2494 | have_timers=yes | ||
2509 | 2495 | fi | ||
2510 | 2496 | ;; | ||
2511 | 2497 | *-*-cygwin* | *-*-mingw32*) | ||
2512 | 2498 | ARCH=win32 | ||
2513 | 2499 | if test "$build" != "$host"; then # cross-compiling | ||
2514 | 2500 | # Default cross-compile location | ||
2515 | 2501 | ac_default_prefix=/usr/local/cross-tools/i386-mingw32 | ||
2516 | 2502 | else | ||
2517 | 2503 | # Look for the location of the tools and install there | ||
2518 | 2504 | if test "$BUILD_PREFIX" != ""; then | ||
2519 | 2505 | ac_default_prefix=$BUILD_PREFIX | ||
2520 | 2506 | fi | ||
2521 | 2507 | fi | ||
2522 | 2508 | CheckDummyVideo | ||
2523 | 2509 | CheckDiskAudio | ||
2524 | 2510 | CheckDummyAudio | ||
2525 | 2511 | CheckWIN32 | ||
2526 | 2512 | CheckWIN32GL | ||
2527 | 2513 | CheckDIRECTX | ||
2528 | 2514 | CheckNASM | ||
2529 | 2515 | # Set up files for the audio library | ||
2530 | 2516 | if test x$enable_audio = xyes; then | ||
2531 | 2517 | AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT) | ||
2532 | 2518 | SOURCES="$SOURCES $srcdir/src/audio/windib/*.c" | ||
2533 | 2519 | if test x$have_directx = xyes; then | ||
2534 | 2520 | AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND) | ||
2535 | 2521 | SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c" | ||
2536 | 2522 | fi | ||
2537 | 2523 | have_audio=yes | ||
2538 | 2524 | fi | ||
2539 | 2525 | # Set up files for the joystick library | ||
2540 | 2526 | if test x$enable_joystick = xyes; then | ||
2541 | 2527 | AC_DEFINE(SDL_JOYSTICK_WINMM) | ||
2542 | 2528 | SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c" | ||
2543 | 2529 | have_joystick=yes | ||
2544 | 2530 | fi | ||
2545 | 2531 | # Set up files for the cdrom library | ||
2546 | 2532 | if test x$enable_cdrom = xyes; then | ||
2547 | 2533 | AC_DEFINE(SDL_CDROM_WIN32) | ||
2548 | 2534 | SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c" | ||
2549 | 2535 | have_cdrom=yes | ||
2550 | 2536 | fi | ||
2551 | 2537 | # Set up files for the thread library | ||
2552 | 2538 | if test x$enable_threads = xyes; then | ||
2553 | 2539 | AC_DEFINE(SDL_THREAD_WIN32) | ||
2554 | 2540 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c" | ||
2555 | 2541 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c" | ||
2556 | 2542 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c" | ||
2557 | 2543 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" | ||
2558 | 2544 | have_threads=yes | ||
2559 | 2545 | fi | ||
2560 | 2546 | # Set up files for the timer library | ||
2561 | 2547 | if test x$enable_timers = xyes; then | ||
2562 | 2548 | AC_DEFINE(SDL_TIMER_WIN32) | ||
2563 | 2549 | SOURCES="$SOURCES $srcdir/src/timer/win32/*.c" | ||
2564 | 2550 | have_timers=yes | ||
2565 | 2551 | fi | ||
2566 | 2552 | # Set up files for the shared object loading library | ||
2567 | 2553 | if test x$enable_loadso = xyes; then | ||
2568 | 2554 | AC_DEFINE(SDL_LOADSO_WIN32) | ||
2569 | 2555 | SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c" | ||
2570 | 2556 | have_loadso=yes | ||
2571 | 2557 | fi | ||
2572 | 2558 | # Set up the system libraries we need | ||
2573 | 2559 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm" | ||
2574 | 2560 | if test x$have_directx = xyes; then | ||
2575 | 2561 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid" | ||
2576 | 2562 | fi | ||
2577 | 2563 | # The Win32 platform requires special setup | ||
2578 | 2564 | SOURCES="$SOURCES $srcdir/src/main/win32/*.rc" | ||
2579 | 2565 | SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c" | ||
2580 | 2566 | SDLMAIN_LDFLAGS="-static" | ||
2581 | 2567 | SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" | ||
2582 | 2568 | SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows" | ||
2583 | 2569 | ;; | ||
2584 | 2570 | *-wince*) | ||
2585 | 2571 | ARCH=win32 | ||
2586 | 2572 | CheckDummyVideo | ||
2587 | 2573 | CheckDiskAudio | ||
2588 | 2574 | CheckDummyAudio | ||
2589 | 2575 | CheckWIN32 | ||
2590 | 2576 | CheckNASM | ||
2591 | 2577 | SOURCES="$SOURCES $srcdir/src/video/gapi/*.c" | ||
2592 | 2578 | EXTRA_CFLAGS="$EXTRA_CFLAGS -D_WIN32_WCE=0x420" | ||
2593 | 2579 | if test x$enable_audio = xyes; then | ||
2594 | 2580 | AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT) | ||
2595 | 2581 | SOURCES="$SOURCES $srcdir/src/audio/windib/*.c" | ||
2596 | 2582 | have_audio=yes | ||
2597 | 2583 | fi | ||
2598 | 2584 | # Set up files for the thread library | ||
2599 | 2585 | if test x$enable_threads = xyes; then | ||
2600 | 2586 | AC_DEFINE(SDL_THREAD_WIN32) | ||
2601 | 2587 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c" | ||
2602 | 2588 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c" | ||
2603 | 2589 | SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c" | ||
2604 | 2590 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" | ||
2605 | 2591 | have_threads=yes | ||
2606 | 2592 | fi | ||
2607 | 2593 | # Set up files for the timer library | ||
2608 | 2594 | if test x$enable_timers = xyes; then | ||
2609 | 2595 | AC_DEFINE(SDL_TIMER_WINCE) | ||
2610 | 2596 | SOURCES="$SOURCES $srcdir/src/timer/wince/*.c" | ||
2611 | 2597 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lmmtimer" | ||
2612 | 2598 | have_timers=yes | ||
2613 | 2599 | fi | ||
2614 | 2600 | # Set up files for the shared object loading library | ||
2615 | 2601 | if test x$enable_loadso = xyes; then | ||
2616 | 2602 | AC_DEFINE(SDL_LOADSO_WIN32) | ||
2617 | 2603 | SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c" | ||
2618 | 2604 | have_loadso=yes | ||
2619 | 2605 | fi | ||
2620 | 2606 | # Set up the system libraries we need | ||
2621 | 2607 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl" | ||
2622 | 2608 | # The Win32 platform requires special setup | ||
2623 | 2609 | SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c" | ||
2624 | 2610 | SDLMAIN_LDFLAGS="-static" | ||
2625 | 2611 | SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420" | ||
2626 | 2612 | SDL_LIBS="-lSDLmain $SDL_LIBS" | ||
2627 | 2613 | ;; | ||
2628 | 2614 | *-*-beos* | *-*-haiku*) | ||
2629 | 2615 | ARCH=beos | ||
2630 | 2616 | ac_default_prefix=/boot/develop/tools/gnupro | ||
2631 | 2617 | CheckDummyVideo | ||
2632 | 2618 | CheckDiskAudio | ||
2633 | 2619 | CheckDummyAudio | ||
2634 | 2620 | CheckNASM | ||
2635 | 2621 | CheckBWINDOW | ||
2636 | 2622 | CheckBeGL | ||
2637 | 2623 | # Set up files for the audio library | ||
2638 | 2624 | if test x$enable_audio = xyes; then | ||
2639 | 2625 | AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO) | ||
2640 | 2626 | SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc" | ||
2641 | 2627 | have_audio=yes | ||
2642 | 2628 | fi | ||
2643 | 2629 | # Set up files for the joystick library | ||
2644 | 2630 | if test x$enable_joystick = xyes; then | ||
2645 | 2631 | AC_DEFINE(SDL_JOYSTICK_BEOS) | ||
2646 | 2632 | SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc" | ||
2647 | 2633 | have_joystick=yes | ||
2648 | 2634 | fi | ||
2649 | 2635 | # Set up files for the cdrom library | ||
2650 | 2636 | if test x$enable_cdrom = xyes; then | ||
2651 | 2637 | AC_DEFINE(SDL_CDROM_BEOS) | ||
2652 | 2638 | SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc" | ||
2653 | 2639 | have_cdrom=yes | ||
2654 | 2640 | fi | ||
2655 | 2641 | # Set up files for the thread library | ||
2656 | 2642 | if test x$enable_threads = xyes; then | ||
2657 | 2643 | AC_DEFINE(SDL_THREAD_BEOS) | ||
2658 | 2644 | SOURCES="$SOURCES $srcdir/src/thread/beos/*.c" | ||
2659 | 2645 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c" | ||
2660 | 2646 | SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" | ||
2661 | 2647 | have_threads=yes | ||
2662 | 2648 | fi | ||
2663 | 2649 | # Set up files for the timer library | ||
2664 | 2650 | if test x$enable_timers = xyes; then | ||
2665 | 2651 | AC_DEFINE(SDL_TIMER_BEOS) | ||
2666 | 2652 | SOURCES="$SOURCES $srcdir/src/timer/beos/*.c" | ||
2667 | 2653 | have_timers=yes | ||
2668 | 2654 | fi | ||
2669 | 2655 | # Set up files for the shared object loading library | ||
2670 | 2656 | if test x$enable_loadso = xyes; then | ||
2671 | 2657 | case "$host" in | ||
2672 | 2658 | *-*-beos*) | ||
2673 | 2659 | AC_DEFINE(SDL_LOADSO_BEOS) | ||
2674 | 2660 | SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c" | ||
2675 | 2661 | ;; | ||
2676 | 2662 | *-*-haiku*) | ||
2677 | 2663 | AC_DEFINE(SDL_LOADSO_DLOPEN) | ||
2678 | 2664 | SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" | ||
2679 | 2665 | ;; | ||
2680 | 2666 | esac | ||
2681 | 2667 | have_loadso=yes | ||
2682 | 2668 | fi | ||
2683 | 2669 | # The BeOS platform requires special setup. | ||
2684 | 2670 | SOURCES="$srcdir/src/main/beos/*.cc $SOURCES" | ||
2685 | 2671 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" | ||
2686 | 2672 | ;; | ||
2687 | 2673 | *-*-darwin* ) | ||
2688 | 2674 | # This could be either full "Mac OS X", or plain "Darwin" which is | ||
2689 | 2675 | # just the OS X kernel sans upper layers like Carbon and Cocoa. | ||
2690 | 2676 | # Next line is broken, and a few files below require Mac OS X (full) | ||
2691 | 2677 | ARCH=macosx | ||
2692 | 2678 | |||
2693 | 2679 | # Mac OS X builds with both the Carbon and OSX APIs at the moment | ||
2694 | 2680 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" | ||
2695 | 2681 | EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" | ||
2696 | 2682 | |||
2697 | 2683 | # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point | ||
2698 | 2684 | # is -lm which is not needed under Mac OS X. But for some reasons it | ||
2699 | 2685 | # also tends to contain spurious -L switches, which we don't want to | ||
2700 | 2686 | # use here or in sdl-config. Hence we reset it. | ||
2701 | 2687 | EXTRA_LDFLAGS="" | ||
2702 | 2688 | |||
2703 | 2689 | CheckVisibilityHidden | ||
2704 | 2690 | CheckDummyVideo | ||
2705 | 2691 | CheckDiskAudio | ||
2706 | 2692 | CheckDummyAudio | ||
2707 | 2693 | CheckDLOPEN | ||
2708 | 2694 | CheckNASM | ||
2709 | 2695 | |||
2710 | 2696 | # Set up files for the shared object loading library | ||
2711 | 2697 | # (this needs to be done before the dynamic X11 check) | ||
2712 | 2698 | if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then | ||
2713 | 2699 | AC_DEFINE(SDL_LOADSO_DLCOMPAT) | ||
2714 | 2700 | SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c" | ||
2715 | 2701 | have_loadso=yes | ||
2716 | 2702 | fi | ||
2717 | 2703 | |||
2718 | 2704 | CheckCOCOA | ||
2719 | 2705 | CheckCARBON | ||
2720 | 2706 | CheckX11 | ||
2721 | 2707 | CheckMacGL | ||
2722 | 2708 | CheckOpenGLX11 | ||
2723 | 2709 | CheckPTHREAD | ||
2724 | 2710 | CheckAltivec | ||
2725 | 2711 | |||
2726 | 2712 | # Need this or things might misbuild on a G3. | ||
2727 | 2713 | EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL" | ||
2728 | 2714 | |||
2729 | 2715 | # Set up files for the audio library | ||
2730 | 2716 | if test x$enable_audio = xyes; then | ||
2731 | 2717 | AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO) | ||
2732 | 2718 | SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c" | ||
2733 | 2719 | have_audio=yes | ||
2734 | 2720 | fi | ||
2735 | 2721 | # Set up files for the joystick library | ||
2736 | 2722 | if test x$enable_joystick = xyes; then | ||
2737 | 2723 | AC_DEFINE(SDL_JOYSTICK_IOKIT) | ||
2738 | 2724 | SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" | ||
2739 | 2725 | have_joystick=yes | ||
2740 | 2726 | need_iokit_framework=yes | ||
2741 | 2727 | fi | ||
2742 | 2728 | # Set up files for the cdrom library | ||
2743 | 2729 | if test x$enable_cdrom = xyes; then | ||
2744 | 2730 | AC_DEFINE(SDL_CDROM_MACOSX) | ||
2745 | 2731 | SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c" | ||
2746 | 2732 | have_cdrom=yes | ||
2747 | 2733 | fi | ||
2748 | 2734 | # Set up files for the timer library | ||
2749 | 2735 | if test x$enable_timers = xyes; then | ||
2750 | 2736 | AC_DEFINE(SDL_TIMER_UNIX) | ||
2751 | 2737 | SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" | ||
2752 | 2738 | have_timers=yes | ||
2753 | 2739 | fi | ||
2754 | 2740 | # The Mac OS X platform requires special setup. | ||
2755 | 2741 | SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m" | ||
2756 | 2742 | SDLMAIN_LDFLAGS="-static" | ||
2757 | 2743 | EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" | ||
2758 | 2744 | SDL_LIBS="-lSDLmain $SDL_LIBS" | ||
2759 | 2745 | if test x$enable_video_cocoa = xyes; then | ||
2760 | 2746 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" | ||
2761 | 2747 | need_iokit_framework=yes | ||
2762 | 2748 | fi | ||
2763 | 2749 | if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then | ||
2764 | 2750 | # The Cocoa backend still needs Carbon | ||
2765 | 2751 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ApplicationServices" | ||
2766 | 2752 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" | ||
2767 | 2753 | fi | ||
2768 | 2754 | # If either the audio or CD driver is used, add the AudioUnit framework | ||
2769 | 2755 | if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then | ||
2770 | 2756 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" | ||
2771 | 2757 | fi | ||
2772 | 2758 | # Some subsystems reference IOKit... | ||
2773 | 2759 | if test x$need_iokit_framework = xyes; then | ||
2774 | 2760 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" | ||
2775 | 2761 | fi | ||
2776 | 2762 | ;; | ||
2777 | 2763 | *-*-mint*) | ||
2778 | 2764 | ARCH=mint | ||
2779 | 2765 | CheckDummyVideo | ||
2780 | 2766 | CheckDiskAudio | ||
2781 | 2767 | CheckDummyAudio | ||
2782 | 2768 | CheckAtariBiosEvent | ||
2783 | 2769 | CheckAtariXbiosVideo | ||
2784 | 2770 | CheckAtariGemVideo | ||
2785 | 2771 | CheckAtariAudio | ||
2786 | 2772 | CheckAtariLdg | ||
2787 | 2773 | CheckAtariOSMesa | ||
2788 | 2774 | CheckPTH | ||
2789 | 2775 | # Set up files for the audio library | ||
2790 | 2776 | if test x$enable_threads = xyes -a x$enable_pth = xyes; then | ||
2791 | 2777 | if test x$enable_audio = xyes; then | ||
2792 | 2778 | AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO) | ||
2793 | 2779 | SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" | ||
2794 | 2780 | have_audio=yes | ||
2795 | 2781 | fi | ||
2796 | 2782 | fi | ||
2797 | 2783 | # Set up files for the joystick library | ||
2798 | 2784 | if test x$enable_joystick = xyes; then | ||
2799 | 2785 | AC_DEFINE(SDL_JOYSTICK_MINT) | ||
2800 | 2786 | SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c" | ||
2801 | 2787 | have_joystick=yes | ||
2802 | 2788 | fi | ||
2803 | 2789 | # Set up files for the cdrom library | ||
2804 | 2790 | if test x$enable_cdrom = xyes; then | ||
2805 | 2791 | AC_DEFINE(SDL_CDROM_MINT) | ||
2806 | 2792 | SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c" | ||
2807 | 2793 | have_cdrom=yes | ||
2808 | 2794 | fi | ||
2809 | 2795 | # Set up files for the timer library | ||
2810 | 2796 | if test x$enable_timers = xyes; then | ||
2811 | 2797 | if test x$enable_threads = xyes -a x$enable_pth = xyes; then | ||
2812 | 2798 | AC_DEFINE(SDL_TIMER_UNIX) | ||
2813 | 2799 | SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" | ||
2814 | 2800 | else | ||
2815 | 2801 | AC_DEFINE(SDL_TIMER_MINT) | ||
2816 | 2802 | SOURCES="$SOURCES $srcdir/src/timer/mint/*.c" | ||
2817 | 2803 | SOURCES="$SOURCES $srcdir/src/timer/mint/*.S" | ||
2818 | 2804 | fi | ||
2819 | 2805 | have_timers=yes | ||
2820 | 2806 | fi | ||
2821 | 2807 | ;; | ||
2822 | 2808 | *-riscos) | ||
2823 | 2809 | ARCH=riscos | ||
2824 | 2810 | CheckOSS | ||
2825 | 2811 | CheckPTHREAD | ||
2826 | 2812 | # Set up files for the video library | ||
2827 | 2813 | if test x$enable_video = xyes; then | ||
2828 | 2814 | AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS) | ||
2829 | 2815 | SOURCES="$SOURCES $srcdir/src/video/riscos/*.c" | ||
2830 | 2816 | SOURCES="$SOURCES $srcdir/src/video/riscos/*.S" | ||
2831 | 2817 | have_video=yes | ||
2832 | 2818 | fi | ||
2833 | 2819 | # Set up files for the joystick library | ||
2834 | 2820 | if test x$enable_joystick = xyes; then | ||
2835 | 2821 | AC_DEFINE(SDL_JOYSTICK_RISCOS) | ||
2836 | 2822 | SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c" | ||
2837 | 2823 | have_joystick=yes | ||
2838 | 2824 | fi | ||
2839 | 2825 | # Set up files for the timer library | ||
2840 | 2826 | if test x$enable_timers = xyes; then | ||
2841 | 2827 | AC_DEFINE(SDL_TIMER_RISCOS) | ||
2842 | 2828 | SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c" | ||
2843 | 2829 | have_timers=yes | ||
2844 | 2830 | fi | ||
2845 | 2831 | # The RISC OS platform requires special setup. | ||
2846 | 2832 | EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz" | ||
2847 | 2833 | ;; | ||
2848 | 2834 | *) | ||
2849 | 2835 | AC_MSG_ERROR([ | ||
2850 | 2836 | *** Unsupported host: Please add to configure.in | ||
2851 | 2837 | ]) | ||
2852 | 2838 | ;; | ||
2853 | 2839 | esac | ||
2854 | 2840 | |||
2855 | 2841 | dnl Do this on all platforms, after everything else. | ||
2856 | 2842 | CheckWarnAll | ||
2857 | 2843 | |||
2858 | 2844 | # Verify that we have all the platform specific files we need | ||
2859 | 2845 | |||
2860 | 2846 | if test x$enable_joystick = xyes; then | ||
2861 | 2847 | if test x$have_joystick != xyes; then | ||
2862 | 2848 | # Wants joystick subsystem, but doesn't have a platform-specific backend... | ||
2863 | 2849 | AC_DEFINE(SDL_JOYSTICK_DUMMY) | ||
2864 | 2850 | SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" | ||
2865 | 2851 | fi | ||
2866 | 2852 | fi | ||
2867 | 2853 | if test x$have_cdrom != xyes; then | ||
2868 | 2854 | if test x$enable_cdrom = xyes; then | ||
2869 | 2855 | AC_DEFINE(SDL_CDROM_DISABLED) | ||
2870 | 2856 | fi | ||
2871 | 2857 | SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c" | ||
2872 | 2858 | fi | ||
2873 | 2859 | if test x$have_threads != xyes; then | ||
2874 | 2860 | if test x$enable_threads = xyes; then | ||
2875 | 2861 | AC_DEFINE(SDL_THREADS_DISABLED) | ||
2876 | 2862 | fi | ||
2877 | 2863 | SOURCES="$SOURCES $srcdir/src/thread/generic/*.c" | ||
2878 | 2864 | fi | ||
2879 | 2865 | if test x$have_timers != xyes; then | ||
2880 | 2866 | if test x$enable_timers = xyes; then | ||
2881 | 2867 | AC_DEFINE(SDL_TIMERS_DISABLED) | ||
2882 | 2868 | fi | ||
2883 | 2869 | SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" | ||
2884 | 2870 | fi | ||
2885 | 2871 | if test x$have_loadso != xyes; then | ||
2886 | 2872 | if test x$enable_loadso = xyes; then | ||
2887 | 2873 | AC_DEFINE(SDL_LOADSO_DISABLED) | ||
2888 | 2874 | fi | ||
2889 | 2875 | SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" | ||
2890 | 2876 | fi | ||
2891 | 2877 | if test x$SDLMAIN_SOURCES = x; then | ||
2892 | 2878 | SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c" | ||
2893 | 2879 | SDLMAIN_LDFLAGS="-static" | ||
2894 | 2880 | fi | ||
2895 | 2881 | |||
2896 | 2882 | OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'` | ||
2897 | 2883 | OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'` | ||
2898 | 2884 | OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'` | ||
2899 | 2885 | OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` | ||
2900 | 2886 | OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'` | ||
2901 | 2887 | OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.lo,g'` | ||
2902 | 2888 | |||
2903 | 2889 | SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'` | ||
2904 | 2890 | SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'` | ||
2905 | 2891 | SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` | ||
2906 | 2892 | |||
2907 | 2893 | # Set runtime shared library paths as needed | ||
2908 | 2894 | |||
2909 | 2895 | if test "x$enable_rpath" = "xyes"; then | ||
2910 | 2896 | if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then | ||
2911 | 2897 | SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" | ||
2912 | 2898 | fi | ||
2913 | 2899 | if test $ARCH = solaris; then | ||
2914 | 2900 | SDL_RLD_FLAGS="-R\${libdir}" | ||
2915 | 2901 | fi | ||
2916 | 2902 | else | ||
2917 | 2903 | SDL_RLD_FLAGS="" | ||
2918 | 2904 | fi | ||
2919 | 2905 | |||
2920 | 2906 | case "$ARCH" in | ||
2921 | 2907 | macosx) | ||
2922 | 2908 | if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then | ||
2923 | 2909 | SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa" | ||
2924 | 2910 | fi | ||
2925 | 2911 | if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then | ||
2926 | 2912 | SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon" | ||
2927 | 2913 | fi | ||
2928 | 2914 | # Evil hack to allow static linking on Mac OS X | ||
2929 | 2915 | SDL_STATIC_LIBS="\${libdir}/libSDLmain.a \${libdir}/libSDL.a $EXTRA_LDFLAGS" | ||
2930 | 2916 | ;; | ||
2931 | 2917 | *) | ||
2932 | 2918 | SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS" | ||
2933 | 2919 | ;; | ||
2934 | 2920 | esac | ||
2935 | 2921 | |||
2936 | 2922 | dnl Expand the cflags and libraries needed by apps using SDL | ||
2937 | 2923 | AC_SUBST(SDL_CFLAGS) | ||
2938 | 2924 | AC_SUBST(SDL_LIBS) | ||
2939 | 2925 | AC_SUBST(SDL_STATIC_LIBS) | ||
2940 | 2926 | AC_SUBST(SDL_RLD_FLAGS) | ||
2941 | 2927 | if test x$enable_shared = xyes; then | ||
2942 | 2928 | ENABLE_SHARED_TRUE= | ||
2943 | 2929 | ENABLE_SHARED_FALSE="#" | ||
2944 | 2930 | else | ||
2945 | 2931 | ENABLE_SHARED_TRUE="#" | ||
2946 | 2932 | ENABLE_SHARED_FALSE= | ||
2947 | 2933 | fi | ||
2948 | 2934 | if test x$enable_static = xyes; then | ||
2949 | 2935 | ENABLE_STATIC_TRUE= | ||
2950 | 2936 | ENABLE_STATIC_FALSE="#" | ||
2951 | 2937 | else | ||
2952 | 2938 | ENABLE_STATIC_TRUE="#" | ||
2953 | 2939 | ENABLE_STATIC_FALSE= | ||
2954 | 2940 | fi | ||
2955 | 2941 | AC_SUBST(ENABLE_SHARED_TRUE) | ||
2956 | 2942 | AC_SUBST(ENABLE_SHARED_FALSE) | ||
2957 | 2943 | AC_SUBST(ENABLE_STATIC_TRUE) | ||
2958 | 2944 | AC_SUBST(ENABLE_STATIC_FALSE) | ||
2959 | 2945 | |||
2960 | 2946 | dnl Expand the sources and objects needed to build the library | ||
2961 | 2947 | AC_SUBST(ac_aux_dir) | ||
2962 | 2948 | AC_SUBST(INCLUDE) | ||
2963 | 2949 | AC_SUBST(SOURCES) | ||
2964 | 2950 | AC_SUBST(OBJECTS) | ||
2965 | 2951 | AC_SUBST(SDLMAIN_SOURCES) | ||
2966 | 2952 | AC_SUBST(SDLMAIN_OBJECTS) | ||
2967 | 2953 | AC_SUBST(SDLMAIN_LDFLAGS) | ||
2968 | 2954 | AC_SUBST(BUILD_CFLAGS) | ||
2969 | 2955 | AC_SUBST(EXTRA_CFLAGS) | ||
2970 | 2956 | AC_SUBST(BUILD_LDFLAGS) | ||
2971 | 2957 | AC_SUBST(EXTRA_LDFLAGS) | ||
2972 | 2958 | AC_SUBST(WINDRES) | ||
2973 | 2959 | |||
2974 | 2960 | AC_OUTPUT([ | ||
2975 | 2961 | Makefile sdl-config SDL.spec SDL.qpg sdl.pc | ||
2976 | 2962 | ], [ | ||
2977 | 2963 | : >build-deps | ||
2978 | 2964 | if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend | ||
2979 | 2965 | ]) | ||
2980 | 0 | 2966 | ||
2981 | === added directory '.pc/mir-support.diff/include' | |||
2982 | === added file '.pc/mir-support.diff/include/SDL_config.h.in' | |||
2983 | --- .pc/mir-support.diff/include/SDL_config.h.in 1970-01-01 00:00:00 +0000 | |||
2984 | +++ .pc/mir-support.diff/include/SDL_config.h.in 2015-06-01 21:48:23 +0000 | |||
2985 | @@ -0,0 +1,312 @@ | |||
2986 | 1 | /* | ||
2987 | 2 | SDL - Simple DirectMedia Layer | ||
2988 | 3 | Copyright (C) 1997-2012 Sam Lantinga | ||
2989 | 4 | |||
2990 | 5 | This library is free software; you can redistribute it and/or | ||
2991 | 6 | modify it under the terms of the GNU Lesser General Public | ||
2992 | 7 | License as published by the Free Software Foundation; either | ||
2993 | 8 | version 2.1 of the License, or (at your option) any later version. | ||
2994 | 9 | |||
2995 | 10 | This library is distributed in the hope that it will be useful, | ||
2996 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2997 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
2998 | 13 | Lesser General Public License for more details. | ||
2999 | 14 | |||
3000 | 15 | You should have received a copy of the GNU Lesser General Public | ||
3001 | 16 | License along with this library; if not, write to the Free Software | ||
3002 | 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
3003 | 18 | |||
3004 | 19 | Sam Lantinga | ||
3005 | 20 | slouken@libsdl.org | ||
3006 | 21 | */ | ||
3007 | 22 | |||
3008 | 23 | #ifndef _SDL_config_h | ||
3009 | 24 | #define _SDL_config_h | ||
3010 | 25 | |||
3011 | 26 | /* This is a set of defines to configure the SDL features */ | ||
3012 | 27 | |||
3013 | 28 | /* General platform specific identifiers */ | ||
3014 | 29 | #include "SDL_platform.h" | ||
3015 | 30 | |||
3016 | 31 | /* Make sure that this isn't included by Visual C++ */ | ||
3017 | 32 | #ifdef _MSC_VER | ||
3018 | 33 | #error You should copy include/SDL_config.h.default to include/SDL_config.h | ||
3019 | 34 | #endif | ||
3020 | 35 | |||
3021 | 36 | /* C language features */ | ||
3022 | 37 | #undef const | ||
3023 | 38 | #undef inline | ||
3024 | 39 | #undef volatile | ||
3025 | 40 | |||
3026 | 41 | /* C datatypes */ | ||
3027 | 42 | #undef size_t | ||
3028 | 43 | #undef int8_t | ||
3029 | 44 | #undef uint8_t | ||
3030 | 45 | #undef int16_t | ||
3031 | 46 | #undef uint16_t | ||
3032 | 47 | #undef int32_t | ||
3033 | 48 | #undef uint32_t | ||
3034 | 49 | #undef int64_t | ||
3035 | 50 | #undef uint64_t | ||
3036 | 51 | #undef uintptr_t | ||
3037 | 52 | #undef SDL_HAS_64BIT_TYPE | ||
3038 | 53 | |||
3039 | 54 | /* Endianness */ | ||
3040 | 55 | #undef SDL_BYTEORDER | ||
3041 | 56 | |||
3042 | 57 | /* Comment this if you want to build without any C library requirements */ | ||
3043 | 58 | #undef HAVE_LIBC | ||
3044 | 59 | #if HAVE_LIBC | ||
3045 | 60 | |||
3046 | 61 | /* Useful headers */ | ||
3047 | 62 | #undef HAVE_ALLOCA_H | ||
3048 | 63 | #undef HAVE_SYS_TYPES_H | ||
3049 | 64 | #undef HAVE_STDIO_H | ||
3050 | 65 | #undef STDC_HEADERS | ||
3051 | 66 | #undef HAVE_STDLIB_H | ||
3052 | 67 | #undef HAVE_STDARG_H | ||
3053 | 68 | #undef HAVE_MALLOC_H | ||
3054 | 69 | #undef HAVE_MEMORY_H | ||
3055 | 70 | #undef HAVE_STRING_H | ||
3056 | 71 | #undef HAVE_STRINGS_H | ||
3057 | 72 | #undef HAVE_INTTYPES_H | ||
3058 | 73 | #undef HAVE_STDINT_H | ||
3059 | 74 | #undef HAVE_CTYPE_H | ||
3060 | 75 | #undef HAVE_MATH_H | ||
3061 | 76 | #undef HAVE_ICONV_H | ||
3062 | 77 | #undef HAVE_SIGNAL_H | ||
3063 | 78 | #undef HAVE_ALTIVEC_H | ||
3064 | 79 | |||
3065 | 80 | /* C library functions */ | ||
3066 | 81 | #undef HAVE_MALLOC | ||
3067 | 82 | #undef HAVE_CALLOC | ||
3068 | 83 | #undef HAVE_REALLOC | ||
3069 | 84 | #undef HAVE_FREE | ||
3070 | 85 | #undef HAVE_ALLOCA | ||
3071 | 86 | #ifndef _WIN32 /* Don't use C runtime versions of these on Windows */ | ||
3072 | 87 | #undef HAVE_GETENV | ||
3073 | 88 | #undef HAVE_PUTENV | ||
3074 | 89 | #undef HAVE_UNSETENV | ||
3075 | 90 | #endif | ||
3076 | 91 | #undef HAVE_QSORT | ||
3077 | 92 | #undef HAVE_ABS | ||
3078 | 93 | #undef HAVE_BCOPY | ||
3079 | 94 | #undef HAVE_MEMSET | ||
3080 | 95 | #undef HAVE_MEMCPY | ||
3081 | 96 | #undef HAVE_MEMMOVE | ||
3082 | 97 | #undef HAVE_MEMCMP | ||
3083 | 98 | #undef HAVE_STRLEN | ||
3084 | 99 | #undef HAVE_STRLCPY | ||
3085 | 100 | #undef HAVE_STRLCAT | ||
3086 | 101 | #undef HAVE_STRDUP | ||
3087 | 102 | #undef HAVE__STRREV | ||
3088 | 103 | #undef HAVE__STRUPR | ||
3089 | 104 | #undef HAVE__STRLWR | ||
3090 | 105 | #undef HAVE_INDEX | ||
3091 | 106 | #undef HAVE_RINDEX | ||
3092 | 107 | #undef HAVE_STRCHR | ||
3093 | 108 | #undef HAVE_STRRCHR | ||
3094 | 109 | #undef HAVE_STRSTR | ||
3095 | 110 | #undef HAVE_ITOA | ||
3096 | 111 | #undef HAVE__LTOA | ||
3097 | 112 | #undef HAVE__UITOA | ||
3098 | 113 | #undef HAVE__ULTOA | ||
3099 | 114 | #undef HAVE_STRTOL | ||
3100 | 115 | #undef HAVE_STRTOUL | ||
3101 | 116 | #undef HAVE__I64TOA | ||
3102 | 117 | #undef HAVE__UI64TOA | ||
3103 | 118 | #undef HAVE_STRTOLL | ||
3104 | 119 | #undef HAVE_STRTOULL | ||
3105 | 120 | #undef HAVE_STRTOD | ||
3106 | 121 | #undef HAVE_ATOI | ||
3107 | 122 | #undef HAVE_ATOF | ||
3108 | 123 | #undef HAVE_STRCMP | ||
3109 | 124 | #undef HAVE_STRNCMP | ||
3110 | 125 | #undef HAVE__STRICMP | ||
3111 | 126 | #undef HAVE_STRCASECMP | ||
3112 | 127 | #undef HAVE__STRNICMP | ||
3113 | 128 | #undef HAVE_STRNCASECMP | ||
3114 | 129 | #undef HAVE_SSCANF | ||
3115 | 130 | #undef HAVE_SNPRINTF | ||
3116 | 131 | #undef HAVE_VSNPRINTF | ||
3117 | 132 | #undef HAVE_ICONV | ||
3118 | 133 | #undef HAVE_SIGACTION | ||
3119 | 134 | #undef HAVE_SA_SIGACTION | ||
3120 | 135 | #undef HAVE_SETJMP | ||
3121 | 136 | #undef HAVE_NANOSLEEP | ||
3122 | 137 | #undef HAVE_CLOCK_GETTIME | ||
3123 | 138 | #undef HAVE_GETPAGESIZE | ||
3124 | 139 | #undef HAVE_MPROTECT | ||
3125 | 140 | #undef HAVE_SEM_TIMEDWAIT | ||
3126 | 141 | |||
3127 | 142 | #else | ||
3128 | 143 | /* We may need some replacement for stdarg.h here */ | ||
3129 | 144 | #include <stdarg.h> | ||
3130 | 145 | #endif /* HAVE_LIBC */ | ||
3131 | 146 | |||
3132 | 147 | /* Allow disabling of core subsystems */ | ||
3133 | 148 | #undef SDL_AUDIO_DISABLED | ||
3134 | 149 | #undef SDL_CDROM_DISABLED | ||
3135 | 150 | #undef SDL_CPUINFO_DISABLED | ||
3136 | 151 | #undef SDL_EVENTS_DISABLED | ||
3137 | 152 | #undef SDL_FILE_DISABLED | ||
3138 | 153 | #undef SDL_JOYSTICK_DISABLED | ||
3139 | 154 | #undef SDL_LOADSO_DISABLED | ||
3140 | 155 | #undef SDL_THREADS_DISABLED | ||
3141 | 156 | #undef SDL_TIMERS_DISABLED | ||
3142 | 157 | #undef SDL_VIDEO_DISABLED | ||
3143 | 158 | |||
3144 | 159 | /* Enable various audio drivers */ | ||
3145 | 160 | #undef SDL_AUDIO_DRIVER_ALSA | ||
3146 | 161 | #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC | ||
3147 | 162 | #undef SDL_AUDIO_DRIVER_ARTS | ||
3148 | 163 | #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC | ||
3149 | 164 | #undef SDL_AUDIO_DRIVER_BAUDIO | ||
3150 | 165 | #undef SDL_AUDIO_DRIVER_BSD | ||
3151 | 166 | #undef SDL_AUDIO_DRIVER_COREAUDIO | ||
3152 | 167 | #undef SDL_AUDIO_DRIVER_DART | ||
3153 | 168 | #undef SDL_AUDIO_DRIVER_DC | ||
3154 | 169 | #undef SDL_AUDIO_DRIVER_DISK | ||
3155 | 170 | #undef SDL_AUDIO_DRIVER_DUMMY | ||
3156 | 171 | #undef SDL_AUDIO_DRIVER_DMEDIA | ||
3157 | 172 | #undef SDL_AUDIO_DRIVER_DSOUND | ||
3158 | 173 | #undef SDL_AUDIO_DRIVER_PULSE | ||
3159 | 174 | #undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC | ||
3160 | 175 | #undef SDL_AUDIO_DRIVER_ESD | ||
3161 | 176 | #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC | ||
3162 | 177 | #undef SDL_AUDIO_DRIVER_MINT | ||
3163 | 178 | #undef SDL_AUDIO_DRIVER_MMEAUDIO | ||
3164 | 179 | #undef SDL_AUDIO_DRIVER_NAS | ||
3165 | 180 | #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC | ||
3166 | 181 | #undef SDL_AUDIO_DRIVER_OSS | ||
3167 | 182 | #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H | ||
3168 | 183 | #undef SDL_AUDIO_DRIVER_PAUD | ||
3169 | 184 | #undef SDL_AUDIO_DRIVER_QNXNTO | ||
3170 | 185 | #undef SDL_AUDIO_DRIVER_SNDMGR | ||
3171 | 186 | #undef SDL_AUDIO_DRIVER_SUNAUDIO | ||
3172 | 187 | #undef SDL_AUDIO_DRIVER_WAVEOUT | ||
3173 | 188 | |||
3174 | 189 | /* Enable various cdrom drivers */ | ||
3175 | 190 | #undef SDL_CDROM_AIX | ||
3176 | 191 | #undef SDL_CDROM_BEOS | ||
3177 | 192 | #undef SDL_CDROM_BSDI | ||
3178 | 193 | #undef SDL_CDROM_DC | ||
3179 | 194 | #undef SDL_CDROM_DUMMY | ||
3180 | 195 | #undef SDL_CDROM_FREEBSD | ||
3181 | 196 | #undef SDL_CDROM_LINUX | ||
3182 | 197 | #undef SDL_CDROM_MACOS | ||
3183 | 198 | #undef SDL_CDROM_MACOSX | ||
3184 | 199 | #undef SDL_CDROM_MINT | ||
3185 | 200 | #undef SDL_CDROM_OPENBSD | ||
3186 | 201 | #undef SDL_CDROM_OS2 | ||
3187 | 202 | #undef SDL_CDROM_OSF | ||
3188 | 203 | #undef SDL_CDROM_QNX | ||
3189 | 204 | #undef SDL_CDROM_WIN32 | ||
3190 | 205 | |||
3191 | 206 | /* Enable various input drivers */ | ||
3192 | 207 | #undef SDL_INPUT_LINUXEV | ||
3193 | 208 | #undef SDL_INPUT_TSLIB | ||
3194 | 209 | #undef SDL_JOYSTICK_BEOS | ||
3195 | 210 | #undef SDL_JOYSTICK_DC | ||
3196 | 211 | #undef SDL_JOYSTICK_DUMMY | ||
3197 | 212 | #undef SDL_JOYSTICK_IOKIT | ||
3198 | 213 | #undef SDL_JOYSTICK_LINUX | ||
3199 | 214 | #undef SDL_JOYSTICK_MACOS | ||
3200 | 215 | #undef SDL_JOYSTICK_MINT | ||
3201 | 216 | #undef SDL_JOYSTICK_OS2 | ||
3202 | 217 | #undef SDL_JOYSTICK_RISCOS | ||
3203 | 218 | #undef SDL_JOYSTICK_WINMM | ||
3204 | 219 | #undef SDL_JOYSTICK_USBHID | ||
3205 | 220 | #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H | ||
3206 | 221 | |||
3207 | 222 | /* Enable various shared object loading systems */ | ||
3208 | 223 | #undef SDL_LOADSO_BEOS | ||
3209 | 224 | #undef SDL_LOADSO_DLCOMPAT | ||
3210 | 225 | #undef SDL_LOADSO_DLOPEN | ||
3211 | 226 | #undef SDL_LOADSO_DUMMY | ||
3212 | 227 | #undef SDL_LOADSO_LDG | ||
3213 | 228 | #undef SDL_LOADSO_MACOS | ||
3214 | 229 | #undef SDL_LOADSO_OS2 | ||
3215 | 230 | #undef SDL_LOADSO_WIN32 | ||
3216 | 231 | |||
3217 | 232 | /* Enable various threading systems */ | ||
3218 | 233 | #undef SDL_THREAD_BEOS | ||
3219 | 234 | #undef SDL_THREAD_DC | ||
3220 | 235 | #undef SDL_THREAD_OS2 | ||
3221 | 236 | #undef SDL_THREAD_PTH | ||
3222 | 237 | #undef SDL_THREAD_PTHREAD | ||
3223 | 238 | #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX | ||
3224 | 239 | #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP | ||
3225 | 240 | #undef SDL_THREAD_SPROC | ||
3226 | 241 | #undef SDL_THREAD_WIN32 | ||
3227 | 242 | |||
3228 | 243 | /* Enable various timer systems */ | ||
3229 | 244 | #undef SDL_TIMER_BEOS | ||
3230 | 245 | #undef SDL_TIMER_DC | ||
3231 | 246 | #undef SDL_TIMER_DUMMY | ||
3232 | 247 | #undef SDL_TIMER_MACOS | ||
3233 | 248 | #undef SDL_TIMER_MINT | ||
3234 | 249 | #undef SDL_TIMER_OS2 | ||
3235 | 250 | #undef SDL_TIMER_RISCOS | ||
3236 | 251 | #undef SDL_TIMER_UNIX | ||
3237 | 252 | #undef SDL_TIMER_WIN32 | ||
3238 | 253 | #undef SDL_TIMER_WINCE | ||
3239 | 254 | |||
3240 | 255 | /* Enable various video drivers */ | ||
3241 | 256 | #undef SDL_VIDEO_DRIVER_AALIB | ||
3242 | 257 | #undef SDL_VIDEO_DRIVER_BWINDOW | ||
3243 | 258 | #undef SDL_VIDEO_DRIVER_CACA | ||
3244 | 259 | #undef SDL_VIDEO_DRIVER_DC | ||
3245 | 260 | #undef SDL_VIDEO_DRIVER_DDRAW | ||
3246 | 261 | #undef SDL_VIDEO_DRIVER_DGA | ||
3247 | 262 | #undef SDL_VIDEO_DRIVER_DIRECTFB | ||
3248 | 263 | #undef SDL_VIDEO_DRIVER_DRAWSPROCKET | ||
3249 | 264 | #undef SDL_VIDEO_DRIVER_DUMMY | ||
3250 | 265 | #undef SDL_VIDEO_DRIVER_FBCON | ||
3251 | 266 | #undef SDL_VIDEO_DRIVER_GAPI | ||
3252 | 267 | #undef SDL_VIDEO_DRIVER_GEM | ||
3253 | 268 | #undef SDL_VIDEO_DRIVER_GGI | ||
3254 | 269 | #undef SDL_VIDEO_DRIVER_IPOD | ||
3255 | 270 | #undef SDL_VIDEO_DRIVER_NANOX | ||
3256 | 271 | #undef SDL_VIDEO_DRIVER_OS2FS | ||
3257 | 272 | #undef SDL_VIDEO_DRIVER_PHOTON | ||
3258 | 273 | #undef SDL_VIDEO_DRIVER_PICOGUI | ||
3259 | 274 | #undef SDL_VIDEO_DRIVER_PS2GS | ||
3260 | 275 | #undef SDL_VIDEO_DRIVER_PS3 | ||
3261 | 276 | #undef SDL_VIDEO_DRIVER_QTOPIA | ||
3262 | 277 | #undef SDL_VIDEO_DRIVER_QUARTZ | ||
3263 | 278 | #undef SDL_VIDEO_DRIVER_RISCOS | ||
3264 | 279 | #undef SDL_VIDEO_DRIVER_SVGALIB | ||
3265 | 280 | #undef SDL_VIDEO_DRIVER_TOOLBOX | ||
3266 | 281 | #undef SDL_VIDEO_DRIVER_VGL | ||
3267 | 282 | #undef SDL_VIDEO_DRIVER_WINDIB | ||
3268 | 283 | #undef SDL_VIDEO_DRIVER_WSCONS | ||
3269 | 284 | #undef SDL_VIDEO_DRIVER_X11 | ||
3270 | 285 | #undef SDL_VIDEO_DRIVER_X11_DGAMOUSE | ||
3271 | 286 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC | ||
3272 | 287 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT | ||
3273 | 288 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR | ||
3274 | 289 | #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER | ||
3275 | 290 | #undef SDL_VIDEO_DRIVER_X11_VIDMODE | ||
3276 | 291 | #undef SDL_VIDEO_DRIVER_X11_XINERAMA | ||
3277 | 292 | #undef SDL_VIDEO_DRIVER_X11_XME | ||
3278 | 293 | #undef SDL_VIDEO_DRIVER_X11_XRANDR | ||
3279 | 294 | #undef SDL_VIDEO_DRIVER_X11_XV | ||
3280 | 295 | #undef SDL_VIDEO_DRIVER_XBIOS | ||
3281 | 296 | |||
3282 | 297 | /* Enable OpenGL support */ | ||
3283 | 298 | #undef SDL_VIDEO_OPENGL | ||
3284 | 299 | #undef SDL_VIDEO_OPENGL_GLX | ||
3285 | 300 | #undef SDL_VIDEO_OPENGL_WGL | ||
3286 | 301 | #undef SDL_VIDEO_OPENGL_OSMESA | ||
3287 | 302 | #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC | ||
3288 | 303 | |||
3289 | 304 | /* Disable screensaver */ | ||
3290 | 305 | #undef SDL_VIDEO_DISABLE_SCREENSAVER | ||
3291 | 306 | |||
3292 | 307 | /* Enable assembly routines */ | ||
3293 | 308 | #undef SDL_ASSEMBLY_ROUTINES | ||
3294 | 309 | #undef SDL_HERMES_BLITTERS | ||
3295 | 310 | #undef SDL_ALTIVEC_BLITTERS | ||
3296 | 311 | |||
3297 | 312 | #endif /* _SDL_config_h */ | ||
3298 | 0 | 313 | ||
3299 | === added directory '.pc/mir-support.diff/src' | |||
3300 | === added directory '.pc/mir-support.diff/src/video' | |||
3301 | === added file '.pc/mir-support.diff/src/video/SDL_sysvideo.h' | |||
3302 | --- .pc/mir-support.diff/src/video/SDL_sysvideo.h 1970-01-01 00:00:00 +0000 | |||
3303 | +++ .pc/mir-support.diff/src/video/SDL_sysvideo.h 2015-06-01 21:48:23 +0000 | |||
3304 | @@ -0,0 +1,424 @@ | |||
3305 | 1 | /* | ||
3306 | 2 | SDL - Simple DirectMedia Layer | ||
3307 | 3 | Copyright (C) 1997-2012 Sam Lantinga | ||
3308 | 4 | |||
3309 | 5 | This library is free software; you can redistribute it and/or | ||
3310 | 6 | modify it under the terms of the GNU Lesser General Public | ||
3311 | 7 | License as published by the Free Software Foundation; either | ||
3312 | 8 | version 2.1 of the License, or (at your option) any later version. | ||
3313 | 9 | |||
3314 | 10 | This library is distributed in the hope that it will be useful, | ||
3315 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3316 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
3317 | 13 | Lesser General Public License for more details. | ||
3318 | 14 | |||
3319 | 15 | You should have received a copy of the GNU Lesser General Public | ||
3320 | 16 | License along with this library; if not, write to the Free Software | ||
3321 | 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
3322 | 18 | |||
3323 | 19 | Sam Lantinga | ||
3324 | 20 | slouken@libsdl.org | ||
3325 | 21 | */ | ||
3326 | 22 | #include "SDL_config.h" | ||
3327 | 23 | |||
3328 | 24 | #ifndef _SDL_sysvideo_h | ||
3329 | 25 | #define _SDL_sysvideo_h | ||
3330 | 26 | |||
3331 | 27 | #include "SDL_mouse.h" | ||
3332 | 28 | #define SDL_PROTOTYPES_ONLY | ||
3333 | 29 | #include "SDL_syswm.h" | ||
3334 | 30 | #undef SDL_PROTOTYPES_ONLY | ||
3335 | 31 | |||
3336 | 32 | /* This file prototypes the video driver implementation. | ||
3337 | 33 | This is designed to be easily converted to C++ in the future. | ||
3338 | 34 | */ | ||
3339 | 35 | |||
3340 | 36 | #if SDL_VIDEO_OPENGL | ||
3341 | 37 | #include "SDL_opengl.h" | ||
3342 | 38 | #endif /* SDL_VIDEO_OPENGL */ | ||
3343 | 39 | |||
3344 | 40 | /* The SDL video driver */ | ||
3345 | 41 | typedef struct SDL_VideoDevice SDL_VideoDevice; | ||
3346 | 42 | |||
3347 | 43 | /* Define the SDL video driver structure */ | ||
3348 | 44 | #define _THIS SDL_VideoDevice *_this | ||
3349 | 45 | #ifndef _STATUS | ||
3350 | 46 | #define _STATUS SDL_status *status | ||
3351 | 47 | #endif | ||
3352 | 48 | struct SDL_VideoDevice { | ||
3353 | 49 | /* * * */ | ||
3354 | 50 | /* The name of this video driver */ | ||
3355 | 51 | const char *name; | ||
3356 | 52 | |||
3357 | 53 | /* * * */ | ||
3358 | 54 | /* Initialization/Query functions */ | ||
3359 | 55 | |||
3360 | 56 | /* Initialize the native video subsystem, filling 'vformat' with the | ||
3361 | 57 | "best" display pixel format, returning 0 or -1 if there's an error. | ||
3362 | 58 | */ | ||
3363 | 59 | int (*VideoInit)(_THIS, SDL_PixelFormat *vformat); | ||
3364 | 60 | |||
3365 | 61 | /* List the available video modes for the given pixel format, sorted | ||
3366 | 62 | from largest to smallest. | ||
3367 | 63 | */ | ||
3368 | 64 | SDL_Rect **(*ListModes)(_THIS, SDL_PixelFormat *format, Uint32 flags); | ||
3369 | 65 | |||
3370 | 66 | /* Set the requested video mode, returning a surface which will be | ||
3371 | 67 | set to the SDL_VideoSurface. The width and height will already | ||
3372 | 68 | be verified by ListModes(), and the video subsystem is free to | ||
3373 | 69 | set the mode to a supported bit depth different from the one | ||
3374 | 70 | specified -- the desired bpp will be emulated with a shadow | ||
3375 | 71 | surface if necessary. If a new mode is returned, this function | ||
3376 | 72 | should take care of cleaning up the current mode. | ||
3377 | 73 | */ | ||
3378 | 74 | SDL_Surface *(*SetVideoMode)(_THIS, SDL_Surface *current, | ||
3379 | 75 | int width, int height, int bpp, Uint32 flags); | ||
3380 | 76 | |||
3381 | 77 | /* Toggle the fullscreen mode */ | ||
3382 | 78 | int (*ToggleFullScreen)(_THIS, int on); | ||
3383 | 79 | |||
3384 | 80 | /* This is called after the video mode has been set, to get the | ||
3385 | 81 | initial mouse state. It should queue events as necessary to | ||
3386 | 82 | properly represent the current mouse focus and position. | ||
3387 | 83 | */ | ||
3388 | 84 | void (*UpdateMouse)(_THIS); | ||
3389 | 85 | |||
3390 | 86 | /* Create a YUV video surface (possibly overlay) of the given | ||
3391 | 87 | format. The hardware should be able to perform at least 2x | ||
3392 | 88 | scaling on display. | ||
3393 | 89 | */ | ||
3394 | 90 | SDL_Overlay *(*CreateYUVOverlay)(_THIS, int width, int height, | ||
3395 | 91 | Uint32 format, SDL_Surface *display); | ||
3396 | 92 | |||
3397 | 93 | /* Sets the color entries { firstcolor .. (firstcolor+ncolors-1) } | ||
3398 | 94 | of the physical palette to those in 'colors'. If the device is | ||
3399 | 95 | using a software palette (SDL_HWPALETTE not set), then the | ||
3400 | 96 | changes are reflected in the logical palette of the screen | ||
3401 | 97 | as well. | ||
3402 | 98 | The return value is 1 if all entries could be set properly | ||
3403 | 99 | or 0 otherwise. | ||
3404 | 100 | */ | ||
3405 | 101 | int (*SetColors)(_THIS, int firstcolor, int ncolors, | ||
3406 | 102 | SDL_Color *colors); | ||
3407 | 103 | |||
3408 | 104 | /* This pointer should exist in the native video subsystem and should | ||
3409 | 105 | point to an appropriate update function for the current video mode | ||
3410 | 106 | */ | ||
3411 | 107 | void (*UpdateRects)(_THIS, int numrects, SDL_Rect *rects); | ||
3412 | 108 | |||
3413 | 109 | /* Reverse the effects VideoInit() -- called if VideoInit() fails | ||
3414 | 110 | or if the application is shutting down the video subsystem. | ||
3415 | 111 | */ | ||
3416 | 112 | void (*VideoQuit)(_THIS); | ||
3417 | 113 | |||
3418 | 114 | /* * * */ | ||
3419 | 115 | /* Hardware acceleration functions */ | ||
3420 | 116 | |||
3421 | 117 | /* Information about the video hardware */ | ||
3422 | 118 | SDL_VideoInfo info; | ||
3423 | 119 | |||
3424 | 120 | /* The pixel format used when SDL_CreateRGBSurface creates SDL_HWSURFACEs with alpha */ | ||
3425 | 121 | SDL_PixelFormat* displayformatalphapixel; | ||
3426 | 122 | |||
3427 | 123 | /* Allocates a surface in video memory */ | ||
3428 | 124 | int (*AllocHWSurface)(_THIS, SDL_Surface *surface); | ||
3429 | 125 | |||
3430 | 126 | /* Sets the hardware accelerated blit function, if any, based | ||
3431 | 127 | on the current flags of the surface (colorkey, alpha, etc.) | ||
3432 | 128 | */ | ||
3433 | 129 | int (*CheckHWBlit)(_THIS, SDL_Surface *src, SDL_Surface *dst); | ||
3434 | 130 | |||
3435 | 131 | /* Fills a surface rectangle with the given color */ | ||
3436 | 132 | int (*FillHWRect)(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); | ||
3437 | 133 | |||
3438 | 134 | /* Sets video mem colorkey and accelerated blit function */ | ||
3439 | 135 | int (*SetHWColorKey)(_THIS, SDL_Surface *surface, Uint32 key); | ||
3440 | 136 | |||
3441 | 137 | /* Sets per surface hardware alpha value */ | ||
3442 | 138 | int (*SetHWAlpha)(_THIS, SDL_Surface *surface, Uint8 value); | ||
3443 | 139 | |||
3444 | 140 | /* Returns a readable/writable surface */ | ||
3445 | 141 | int (*LockHWSurface)(_THIS, SDL_Surface *surface); | ||
3446 | 142 | void (*UnlockHWSurface)(_THIS, SDL_Surface *surface); | ||
3447 | 143 | |||
3448 | 144 | /* Performs hardware flipping */ | ||
3449 | 145 | int (*FlipHWSurface)(_THIS, SDL_Surface *surface); | ||
3450 | 146 | |||
3451 | 147 | /* Frees a previously allocated video surface */ | ||
3452 | 148 | void (*FreeHWSurface)(_THIS, SDL_Surface *surface); | ||
3453 | 149 | |||
3454 | 150 | /* * * */ | ||
3455 | 151 | /* Gamma support */ | ||
3456 | 152 | |||
3457 | 153 | Uint16 *gamma; | ||
3458 | 154 | |||
3459 | 155 | /* Set the gamma correction directly (emulated with gamma ramps) */ | ||
3460 | 156 | int (*SetGamma)(_THIS, float red, float green, float blue); | ||
3461 | 157 | |||
3462 | 158 | /* Get the gamma correction directly (emulated with gamma ramps) */ | ||
3463 | 159 | int (*GetGamma)(_THIS, float *red, float *green, float *blue); | ||
3464 | 160 | |||
3465 | 161 | /* Set the gamma ramp */ | ||
3466 | 162 | int (*SetGammaRamp)(_THIS, Uint16 *ramp); | ||
3467 | 163 | |||
3468 | 164 | /* Get the gamma ramp */ | ||
3469 | 165 | int (*GetGammaRamp)(_THIS, Uint16 *ramp); | ||
3470 | 166 | |||
3471 | 167 | /* * * */ | ||
3472 | 168 | /* OpenGL support */ | ||
3473 | 169 | |||
3474 | 170 | /* Sets the dll to use for OpenGL and loads it */ | ||
3475 | 171 | int (*GL_LoadLibrary)(_THIS, const char *path); | ||
3476 | 172 | |||
3477 | 173 | /* Retrieves the address of a function in the gl library */ | ||
3478 | 174 | void* (*GL_GetProcAddress)(_THIS, const char *proc); | ||
3479 | 175 | |||
3480 | 176 | /* Get attribute information from the windowing system. */ | ||
3481 | 177 | int (*GL_GetAttribute)(_THIS, SDL_GLattr attrib, int* value); | ||
3482 | 178 | |||
3483 | 179 | /* Make the context associated with this driver current */ | ||
3484 | 180 | int (*GL_MakeCurrent)(_THIS); | ||
3485 | 181 | |||
3486 | 182 | /* Swap the current buffers in double buffer mode. */ | ||
3487 | 183 | void (*GL_SwapBuffers)(_THIS); | ||
3488 | 184 | |||
3489 | 185 | /* OpenGL functions for SDL_OPENGLBLIT */ | ||
3490 | 186 | #if SDL_VIDEO_OPENGL | ||
3491 | 187 | #if !defined(__WIN32__) | ||
3492 | 188 | #define WINAPI | ||
3493 | 189 | #endif | ||
3494 | 190 | #define SDL_PROC(ret,func,params) ret (WINAPI *func) params; | ||
3495 | 191 | #include "SDL_glfuncs.h" | ||
3496 | 192 | #undef SDL_PROC | ||
3497 | 193 | |||
3498 | 194 | /* Texture id */ | ||
3499 | 195 | GLuint texture; | ||
3500 | 196 | #endif | ||
3501 | 197 | int is_32bit; | ||
3502 | 198 | |||
3503 | 199 | /* * * */ | ||
3504 | 200 | /* Window manager functions */ | ||
3505 | 201 | |||
3506 | 202 | /* Set the title and icon text */ | ||
3507 | 203 | void (*SetCaption)(_THIS, const char *title, const char *icon); | ||
3508 | 204 | |||
3509 | 205 | /* Set the window icon image */ | ||
3510 | 206 | void (*SetIcon)(_THIS, SDL_Surface *icon, Uint8 *mask); | ||
3511 | 207 | |||
3512 | 208 | /* Iconify the window. | ||
3513 | 209 | This function returns 1 if there is a window manager and the | ||
3514 | 210 | window was actually iconified, it returns 0 otherwise. | ||
3515 | 211 | */ | ||
3516 | 212 | int (*IconifyWindow)(_THIS); | ||
3517 | 213 | |||
3518 | 214 | /* Grab or ungrab keyboard and mouse input */ | ||
3519 | 215 | SDL_GrabMode (*GrabInput)(_THIS, SDL_GrabMode mode); | ||
3520 | 216 | |||
3521 | 217 | /* Get some platform dependent window information */ | ||
3522 | 218 | int (*GetWMInfo)(_THIS, SDL_SysWMinfo *info); | ||
3523 | 219 | |||
3524 | 220 | /* * * */ | ||
3525 | 221 | /* Cursor manager functions */ | ||
3526 | 222 | |||
3527 | 223 | /* Free a window manager cursor | ||
3528 | 224 | This function can be NULL if CreateWMCursor is also NULL. | ||
3529 | 225 | */ | ||
3530 | 226 | void (*FreeWMCursor)(_THIS, WMcursor *cursor); | ||
3531 | 227 | |||
3532 | 228 | /* If not NULL, create a black/white window manager cursor */ | ||
3533 | 229 | WMcursor *(*CreateWMCursor)(_THIS, | ||
3534 | 230 | Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); | ||
3535 | 231 | |||
3536 | 232 | /* Show the specified cursor, or hide if cursor is NULL */ | ||
3537 | 233 | int (*ShowWMCursor)(_THIS, WMcursor *cursor); | ||
3538 | 234 | |||
3539 | 235 | /* Warp the window manager cursor to (x,y) | ||
3540 | 236 | If NULL, a mouse motion event is posted internally. | ||
3541 | 237 | */ | ||
3542 | 238 | void (*WarpWMCursor)(_THIS, Uint16 x, Uint16 y); | ||
3543 | 239 | |||
3544 | 240 | /* If not NULL, this is called when a mouse motion event occurs */ | ||
3545 | 241 | void (*MoveWMCursor)(_THIS, int x, int y); | ||
3546 | 242 | |||
3547 | 243 | /* Determine whether the mouse should be in relative mode or not. | ||
3548 | 244 | This function is called when the input grab state or cursor | ||
3549 | 245 | visibility state changes. | ||
3550 | 246 | If the cursor is not visible, and the input is grabbed, the | ||
3551 | 247 | driver can place the mouse in relative mode, which may result | ||
3552 | 248 | in higher accuracy sampling of the pointer motion. | ||
3553 | 249 | */ | ||
3554 | 250 | void (*CheckMouseMode)(_THIS); | ||
3555 | 251 | |||
3556 | 252 | /* * * */ | ||
3557 | 253 | /* Event manager functions */ | ||
3558 | 254 | |||
3559 | 255 | /* Initialize keyboard mapping for this driver */ | ||
3560 | 256 | void (*InitOSKeymap)(_THIS); | ||
3561 | 257 | |||
3562 | 258 | /* Handle any queued OS events */ | ||
3563 | 259 | void (*PumpEvents)(_THIS); | ||
3564 | 260 | |||
3565 | 261 | /* * * */ | ||
3566 | 262 | /* Data common to all drivers */ | ||
3567 | 263 | SDL_Surface *screen; | ||
3568 | 264 | SDL_Surface *shadow; | ||
3569 | 265 | SDL_Surface *visible; | ||
3570 | 266 | SDL_Palette *physpal; /* physical palette, if != logical palette */ | ||
3571 | 267 | SDL_Color *gammacols; /* gamma-corrected colours, or NULL */ | ||
3572 | 268 | char *wm_title; | ||
3573 | 269 | char *wm_icon; | ||
3574 | 270 | int offset_x; | ||
3575 | 271 | int offset_y; | ||
3576 | 272 | SDL_GrabMode input_grab; | ||
3577 | 273 | |||
3578 | 274 | /* Driver information flags */ | ||
3579 | 275 | int handles_any_size; /* Driver handles any size video mode */ | ||
3580 | 276 | |||
3581 | 277 | /* * * */ | ||
3582 | 278 | /* Data used by the GL drivers */ | ||
3583 | 279 | struct { | ||
3584 | 280 | int red_size; | ||
3585 | 281 | int green_size; | ||
3586 | 282 | int blue_size; | ||
3587 | 283 | int alpha_size; | ||
3588 | 284 | int depth_size; | ||
3589 | 285 | int buffer_size; | ||
3590 | 286 | int stencil_size; | ||
3591 | 287 | int double_buffer; | ||
3592 | 288 | int accum_red_size; | ||
3593 | 289 | int accum_green_size; | ||
3594 | 290 | int accum_blue_size; | ||
3595 | 291 | int accum_alpha_size; | ||
3596 | 292 | int stereo; | ||
3597 | 293 | int multisamplebuffers; | ||
3598 | 294 | int multisamplesamples; | ||
3599 | 295 | int accelerated; | ||
3600 | 296 | int swap_control; | ||
3601 | 297 | int driver_loaded; | ||
3602 | 298 | char driver_path[256]; | ||
3603 | 299 | void* dll_handle; | ||
3604 | 300 | } gl_config; | ||
3605 | 301 | |||
3606 | 302 | /* * * */ | ||
3607 | 303 | /* Data private to this driver */ | ||
3608 | 304 | struct SDL_PrivateVideoData *hidden; | ||
3609 | 305 | struct SDL_PrivateGLData *gl_data; | ||
3610 | 306 | |||
3611 | 307 | /* * * */ | ||
3612 | 308 | /* The function used to dispose of this structure */ | ||
3613 | 309 | void (*free)(_THIS); | ||
3614 | 310 | }; | ||
3615 | 311 | #undef _THIS | ||
3616 | 312 | |||
3617 | 313 | typedef struct VideoBootStrap { | ||
3618 | 314 | const char *name; | ||
3619 | 315 | const char *desc; | ||
3620 | 316 | int (*available)(void); | ||
3621 | 317 | SDL_VideoDevice *(*create)(int devindex); | ||
3622 | 318 | } VideoBootStrap; | ||
3623 | 319 | |||
3624 | 320 | #if SDL_VIDEO_DRIVER_QUARTZ | ||
3625 | 321 | extern VideoBootStrap QZ_bootstrap; | ||
3626 | 322 | #endif | ||
3627 | 323 | #if SDL_VIDEO_DRIVER_X11 | ||
3628 | 324 | extern VideoBootStrap X11_bootstrap; | ||
3629 | 325 | #endif | ||
3630 | 326 | #if SDL_VIDEO_DRIVER_DGA | ||
3631 | 327 | extern VideoBootStrap DGA_bootstrap; | ||
3632 | 328 | #endif | ||
3633 | 329 | #if SDL_VIDEO_DRIVER_NANOX | ||
3634 | 330 | extern VideoBootStrap NX_bootstrap; | ||
3635 | 331 | #endif | ||
3636 | 332 | #if SDL_VIDEO_DRIVER_IPOD | ||
3637 | 333 | extern VideoBootStrap iPod_bootstrap; | ||
3638 | 334 | #endif | ||
3639 | 335 | #if SDL_VIDEO_DRIVER_QTOPIA | ||
3640 | 336 | extern VideoBootStrap Qtopia_bootstrap; | ||
3641 | 337 | #endif | ||
3642 | 338 | #if SDL_VIDEO_DRIVER_WSCONS | ||
3643 | 339 | extern VideoBootStrap WSCONS_bootstrap; | ||
3644 | 340 | #endif | ||
3645 | 341 | #if SDL_VIDEO_DRIVER_FBCON | ||
3646 | 342 | extern VideoBootStrap FBCON_bootstrap; | ||
3647 | 343 | #endif | ||
3648 | 344 | #if SDL_VIDEO_DRIVER_DIRECTFB | ||
3649 | 345 | extern VideoBootStrap DirectFB_bootstrap; | ||
3650 | 346 | #endif | ||
3651 | 347 | #if SDL_VIDEO_DRIVER_PS2GS | ||
3652 | 348 | extern VideoBootStrap PS2GS_bootstrap; | ||
3653 | 349 | #endif | ||
3654 | 350 | #if SDL_VIDEO_DRIVER_PS3 | ||
3655 | 351 | extern VideoBootStrap PS3_bootstrap; | ||
3656 | 352 | #endif | ||
3657 | 353 | #if SDL_VIDEO_DRIVER_GGI | ||
3658 | 354 | extern VideoBootStrap GGI_bootstrap; | ||
3659 | 355 | #endif | ||
3660 | 356 | #if SDL_VIDEO_DRIVER_VGL | ||
3661 | 357 | extern VideoBootStrap VGL_bootstrap; | ||
3662 | 358 | #endif | ||
3663 | 359 | #if SDL_VIDEO_DRIVER_SVGALIB | ||
3664 | 360 | extern VideoBootStrap SVGALIB_bootstrap; | ||
3665 | 361 | #endif | ||
3666 | 362 | #if SDL_VIDEO_DRIVER_GAPI | ||
3667 | 363 | extern VideoBootStrap GAPI_bootstrap; | ||
3668 | 364 | #endif | ||
3669 | 365 | #if SDL_VIDEO_DRIVER_WINDIB | ||
3670 | 366 | extern VideoBootStrap WINDIB_bootstrap; | ||
3671 | 367 | #endif | ||
3672 | 368 | #if SDL_VIDEO_DRIVER_DDRAW | ||
3673 | 369 | extern VideoBootStrap DIRECTX_bootstrap; | ||
3674 | 370 | #endif | ||
3675 | 371 | #if SDL_VIDEO_DRIVER_BWINDOW | ||
3676 | 372 | extern VideoBootStrap BWINDOW_bootstrap; | ||
3677 | 373 | #endif | ||
3678 | 374 | #if SDL_VIDEO_DRIVER_TOOLBOX | ||
3679 | 375 | extern VideoBootStrap TOOLBOX_bootstrap; | ||
3680 | 376 | #endif | ||
3681 | 377 | #if SDL_VIDEO_DRIVER_DRAWSPROCKET | ||
3682 | 378 | extern VideoBootStrap DSp_bootstrap; | ||
3683 | 379 | #endif | ||
3684 | 380 | #if SDL_VIDEO_DRIVER_PHOTON | ||
3685 | 381 | extern VideoBootStrap ph_bootstrap; | ||
3686 | 382 | #endif | ||
3687 | 383 | #if SDL_VIDEO_DRIVER_EPOC | ||
3688 | 384 | extern VideoBootStrap EPOC_bootstrap; | ||
3689 | 385 | #endif | ||
3690 | 386 | #if SDL_VIDEO_DRIVER_XBIOS | ||
3691 | 387 | extern VideoBootStrap XBIOS_bootstrap; | ||
3692 | 388 | #endif | ||
3693 | 389 | #if SDL_VIDEO_DRIVER_GEM | ||
3694 | 390 | extern VideoBootStrap GEM_bootstrap; | ||
3695 | 391 | #endif | ||
3696 | 392 | #if SDL_VIDEO_DRIVER_PICOGUI | ||
3697 | 393 | extern VideoBootStrap PG_bootstrap; | ||
3698 | 394 | #endif | ||
3699 | 395 | #if SDL_VIDEO_DRIVER_DC | ||
3700 | 396 | extern VideoBootStrap DC_bootstrap; | ||
3701 | 397 | #endif | ||
3702 | 398 | #if SDL_VIDEO_DRIVER_NDS | ||
3703 | 399 | extern VideoBootStrap NDS_bootstrap; | ||
3704 | 400 | #endif | ||
3705 | 401 | #if SDL_VIDEO_DRIVER_RISCOS | ||
3706 | 402 | extern VideoBootStrap RISCOS_bootstrap; | ||
3707 | 403 | #endif | ||
3708 | 404 | #if SDL_VIDEO_DRIVER_OS2FS | ||
3709 | 405 | extern VideoBootStrap OS2FSLib_bootstrap; | ||
3710 | 406 | #endif | ||
3711 | 407 | #if SDL_VIDEO_DRIVER_AALIB | ||
3712 | 408 | extern VideoBootStrap AALIB_bootstrap; | ||
3713 | 409 | #endif | ||
3714 | 410 | #if SDL_VIDEO_DRIVER_CACA | ||
3715 | 411 | extern VideoBootStrap CACA_bootstrap; | ||
3716 | 412 | #endif | ||
3717 | 413 | #if SDL_VIDEO_DRIVER_DUMMY | ||
3718 | 414 | extern VideoBootStrap DUMMY_bootstrap; | ||
3719 | 415 | #endif | ||
3720 | 416 | |||
3721 | 417 | /* This is the current video device */ | ||
3722 | 418 | extern SDL_VideoDevice *current_video; | ||
3723 | 419 | |||
3724 | 420 | #define SDL_VideoSurface (current_video->screen) | ||
3725 | 421 | #define SDL_ShadowSurface (current_video->shadow) | ||
3726 | 422 | #define SDL_PublicSurface (current_video->visible) | ||
3727 | 423 | |||
3728 | 424 | #endif /* _SDL_sysvideo_h */ | ||
3729 | 0 | 425 | ||
3730 | === added file '.pc/mir-support.diff/src/video/SDL_video.c' | |||
3731 | --- .pc/mir-support.diff/src/video/SDL_video.c 1970-01-01 00:00:00 +0000 | |||
3732 | +++ .pc/mir-support.diff/src/video/SDL_video.c 2015-06-01 21:48:23 +0000 | |||
3733 | @@ -0,0 +1,1978 @@ | |||
3734 | 1 | /* | ||
3735 | 2 | SDL - Simple DirectMedia Layer | ||
3736 | 3 | Copyright (C) 1997-2012 Sam Lantinga | ||
3737 | 4 | |||
3738 | 5 | This library is free software; you can redistribute it and/or | ||
3739 | 6 | modify it under the terms of the GNU Lesser General Public | ||
3740 | 7 | License as published by the Free Software Foundation; either | ||
3741 | 8 | version 2.1 of the License, or (at your option) any later version. | ||
3742 | 9 | |||
3743 | 10 | This library is distributed in the hope that it will be useful, | ||
3744 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3745 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
3746 | 13 | Lesser General Public License for more details. | ||
3747 | 14 | |||
3748 | 15 | You should have received a copy of the GNU Lesser General Public | ||
3749 | 16 | License along with this library; if not, write to the Free Software | ||
3750 | 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
3751 | 18 | |||
3752 | 19 | Sam Lantinga | ||
3753 | 20 | slouken@libsdl.org | ||
3754 | 21 | */ | ||
3755 | 22 | #include "SDL_config.h" | ||
3756 | 23 | |||
3757 | 24 | /* The high-level video driver subsystem */ | ||
3758 | 25 | |||
3759 | 26 | #include "SDL.h" | ||
3760 | 27 | #include "SDL_sysvideo.h" | ||
3761 | 28 | #include "SDL_blit.h" | ||
3762 | 29 | #include "SDL_pixels_c.h" | ||
3763 | 30 | #include "SDL_cursor_c.h" | ||
3764 | 31 | #include "../events/SDL_sysevents.h" | ||
3765 | 32 | #include "../events/SDL_events_c.h" | ||
3766 | 33 | |||
3767 | 34 | /* Available video drivers */ | ||
3768 | 35 | static VideoBootStrap *bootstrap[] = { | ||
3769 | 36 | #if SDL_VIDEO_DRIVER_QUARTZ | ||
3770 | 37 | &QZ_bootstrap, | ||
3771 | 38 | #endif | ||
3772 | 39 | #if SDL_VIDEO_DRIVER_X11 | ||
3773 | 40 | &X11_bootstrap, | ||
3774 | 41 | #endif | ||
3775 | 42 | #if SDL_VIDEO_DRIVER_DGA | ||
3776 | 43 | &DGA_bootstrap, | ||
3777 | 44 | #endif | ||
3778 | 45 | #if SDL_VIDEO_DRIVER_NANOX | ||
3779 | 46 | &NX_bootstrap, | ||
3780 | 47 | #endif | ||
3781 | 48 | #if SDL_VIDEO_DRIVER_IPOD | ||
3782 | 49 | &iPod_bootstrap, | ||
3783 | 50 | #endif | ||
3784 | 51 | #if SDL_VIDEO_DRIVER_QTOPIA | ||
3785 | 52 | &Qtopia_bootstrap, | ||
3786 | 53 | #endif | ||
3787 | 54 | #if SDL_VIDEO_DRIVER_WSCONS | ||
3788 | 55 | &WSCONS_bootstrap, | ||
3789 | 56 | #endif | ||
3790 | 57 | #if SDL_VIDEO_DRIVER_FBCON | ||
3791 | 58 | &FBCON_bootstrap, | ||
3792 | 59 | #endif | ||
3793 | 60 | #if SDL_VIDEO_DRIVER_DIRECTFB | ||
3794 | 61 | &DirectFB_bootstrap, | ||
3795 | 62 | #endif | ||
3796 | 63 | #if SDL_VIDEO_DRIVER_PS2GS | ||
3797 | 64 | &PS2GS_bootstrap, | ||
3798 | 65 | #endif | ||
3799 | 66 | #if SDL_VIDEO_DRIVER_PS3 | ||
3800 | 67 | &PS3_bootstrap, | ||
3801 | 68 | #endif | ||
3802 | 69 | #if SDL_VIDEO_DRIVER_GGI | ||
3803 | 70 | &GGI_bootstrap, | ||
3804 | 71 | #endif | ||
3805 | 72 | #if SDL_VIDEO_DRIVER_VGL | ||
3806 | 73 | &VGL_bootstrap, | ||
3807 | 74 | #endif | ||
3808 | 75 | #if SDL_VIDEO_DRIVER_SVGALIB | ||
3809 | 76 | &SVGALIB_bootstrap, | ||
3810 | 77 | #endif | ||
3811 | 78 | #if SDL_VIDEO_DRIVER_GAPI | ||
3812 | 79 | &GAPI_bootstrap, | ||
3813 | 80 | #endif | ||
3814 | 81 | #if SDL_VIDEO_DRIVER_WINDIB | ||
3815 | 82 | &WINDIB_bootstrap, | ||
3816 | 83 | #endif | ||
3817 | 84 | #if SDL_VIDEO_DRIVER_DDRAW | ||
3818 | 85 | &DIRECTX_bootstrap, | ||
3819 | 86 | #endif | ||
3820 | 87 | #if SDL_VIDEO_DRIVER_BWINDOW | ||
3821 | 88 | &BWINDOW_bootstrap, | ||
3822 | 89 | #endif | ||
3823 | 90 | #if SDL_VIDEO_DRIVER_TOOLBOX | ||
3824 | 91 | &TOOLBOX_bootstrap, | ||
3825 | 92 | #endif | ||
3826 | 93 | #if SDL_VIDEO_DRIVER_DRAWSPROCKET | ||
3827 | 94 | &DSp_bootstrap, | ||
3828 | 95 | #endif | ||
3829 | 96 | #if SDL_VIDEO_DRIVER_PHOTON | ||
3830 | 97 | &ph_bootstrap, | ||
3831 | 98 | #endif | ||
3832 | 99 | #if SDL_VIDEO_DRIVER_EPOC | ||
3833 | 100 | &EPOC_bootstrap, | ||
3834 | 101 | #endif | ||
3835 | 102 | #if SDL_VIDEO_DRIVER_XBIOS | ||
3836 | 103 | &XBIOS_bootstrap, | ||
3837 | 104 | #endif | ||
3838 | 105 | #if SDL_VIDEO_DRIVER_GEM | ||
3839 | 106 | &GEM_bootstrap, | ||
3840 | 107 | #endif | ||
3841 | 108 | #if SDL_VIDEO_DRIVER_PICOGUI | ||
3842 | 109 | &PG_bootstrap, | ||
3843 | 110 | #endif | ||
3844 | 111 | #if SDL_VIDEO_DRIVER_DC | ||
3845 | 112 | &DC_bootstrap, | ||
3846 | 113 | #endif | ||
3847 | 114 | #if SDL_VIDEO_DRIVER_NDS | ||
3848 | 115 | &NDS_bootstrap, | ||
3849 | 116 | #endif | ||
3850 | 117 | #if SDL_VIDEO_DRIVER_RISCOS | ||
3851 | 118 | &RISCOS_bootstrap, | ||
3852 | 119 | #endif | ||
3853 | 120 | #if SDL_VIDEO_DRIVER_OS2FS | ||
3854 | 121 | &OS2FSLib_bootstrap, | ||
3855 | 122 | #endif | ||
3856 | 123 | #if SDL_VIDEO_DRIVER_AALIB | ||
3857 | 124 | &AALIB_bootstrap, | ||
3858 | 125 | #endif | ||
3859 | 126 | #if SDL_VIDEO_DRIVER_CACA | ||
3860 | 127 | &CACA_bootstrap, | ||
3861 | 128 | #endif | ||
3862 | 129 | #if SDL_VIDEO_DRIVER_DUMMY | ||
3863 | 130 | &DUMMY_bootstrap, | ||
3864 | 131 | #endif | ||
3865 | 132 | NULL | ||
3866 | 133 | }; | ||
3867 | 134 | |||
3868 | 135 | SDL_VideoDevice *current_video = NULL; | ||
3869 | 136 | |||
3870 | 137 | /* Various local functions */ | ||
3871 | 138 | int SDL_VideoInit(const char *driver_name, Uint32 flags); | ||
3872 | 139 | void SDL_VideoQuit(void); | ||
3873 | 140 | void SDL_GL_UpdateRectsLock(SDL_VideoDevice* this, int numrects, SDL_Rect* rects); | ||
3874 | 141 | |||
3875 | 142 | static SDL_GrabMode SDL_WM_GrabInputOff(void); | ||
3876 | 143 | #if SDL_VIDEO_OPENGL | ||
3877 | 144 | static int lock_count = 0; | ||
3878 | 145 | #endif | ||
3879 | 146 | |||
3880 | 147 | |||
3881 | 148 | /* | ||
3882 | 149 | * Initialize the video and event subsystems -- determine native pixel format | ||
3883 | 150 | */ | ||
3884 | 151 | int SDL_VideoInit (const char *driver_name, Uint32 flags) | ||
3885 | 152 | { | ||
3886 | 153 | SDL_VideoDevice *video; | ||
3887 | 154 | int index; | ||
3888 | 155 | int i; | ||
3889 | 156 | SDL_PixelFormat vformat; | ||
3890 | 157 | Uint32 video_flags; | ||
3891 | 158 | |||
3892 | 159 | /* Toggle the event thread flags, based on OS requirements */ | ||
3893 | 160 | #if defined(MUST_THREAD_EVENTS) | ||
3894 | 161 | flags |= SDL_INIT_EVENTTHREAD; | ||
3895 | 162 | #elif defined(CANT_THREAD_EVENTS) | ||
3896 | 163 | if ( (flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD ) { | ||
3897 | 164 | SDL_SetError("OS doesn't support threaded events"); | ||
3898 | 165 | return(-1); | ||
3899 | 166 | } | ||
3900 | 167 | #endif | ||
3901 | 168 | |||
3902 | 169 | /* Check to make sure we don't overwrite 'current_video' */ | ||
3903 | 170 | if ( current_video != NULL ) { | ||
3904 | 171 | SDL_VideoQuit(); | ||
3905 | 172 | } | ||
3906 | 173 | |||
3907 | 174 | /* Select the proper video driver */ | ||
3908 | 175 | index = 0; | ||
3909 | 176 | video = NULL; | ||
3910 | 177 | if ( driver_name != NULL ) { | ||
3911 | 178 | #if 0 /* This will be replaced with a better driver selection API */ | ||
3912 | 179 | if ( SDL_strrchr(driver_name, ':') != NULL ) { | ||
3913 | 180 | index = atoi(SDL_strrchr(driver_name, ':')+1); | ||
3914 | 181 | } | ||
3915 | 182 | #endif | ||
3916 | 183 | for ( i=0; bootstrap[i]; ++i ) { | ||
3917 | 184 | if ( SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) { | ||
3918 | 185 | if ( bootstrap[i]->available() ) { | ||
3919 | 186 | video = bootstrap[i]->create(index); | ||
3920 | 187 | break; | ||
3921 | 188 | } | ||
3922 | 189 | } | ||
3923 | 190 | } | ||
3924 | 191 | } else { | ||
3925 | 192 | for ( i=0; bootstrap[i]; ++i ) { | ||
3926 | 193 | if ( bootstrap[i]->available() ) { | ||
3927 | 194 | video = bootstrap[i]->create(index); | ||
3928 | 195 | if ( video != NULL ) { | ||
3929 | 196 | break; | ||
3930 | 197 | } | ||
3931 | 198 | } | ||
3932 | 199 | } | ||
3933 | 200 | } | ||
3934 | 201 | if ( video == NULL ) { | ||
3935 | 202 | SDL_SetError("No available video device"); | ||
3936 | 203 | return(-1); | ||
3937 | 204 | } | ||
3938 | 205 | current_video = video; | ||
3939 | 206 | current_video->name = bootstrap[i]->name; | ||
3940 | 207 | |||
3941 | 208 | /* Do some basic variable initialization */ | ||
3942 | 209 | video->screen = NULL; | ||
3943 | 210 | video->shadow = NULL; | ||
3944 | 211 | video->visible = NULL; | ||
3945 | 212 | video->physpal = NULL; | ||
3946 | 213 | video->gammacols = NULL; | ||
3947 | 214 | video->gamma = NULL; | ||
3948 | 215 | video->wm_title = NULL; | ||
3949 | 216 | video->wm_icon = NULL; | ||
3950 | 217 | video->offset_x = 0; | ||
3951 | 218 | video->offset_y = 0; | ||
3952 | 219 | SDL_memset(&video->info, 0, (sizeof video->info)); | ||
3953 | 220 | |||
3954 | 221 | video->displayformatalphapixel = NULL; | ||
3955 | 222 | |||
3956 | 223 | /* Set some very sane GL defaults */ | ||
3957 | 224 | video->gl_config.driver_loaded = 0; | ||
3958 | 225 | video->gl_config.dll_handle = NULL; | ||
3959 | 226 | video->gl_config.red_size = 3; | ||
3960 | 227 | video->gl_config.green_size = 3; | ||
3961 | 228 | video->gl_config.blue_size = 2; | ||
3962 | 229 | video->gl_config.alpha_size = 0; | ||
3963 | 230 | video->gl_config.buffer_size = 0; | ||
3964 | 231 | video->gl_config.depth_size = 16; | ||
3965 | 232 | video->gl_config.stencil_size = 0; | ||
3966 | 233 | video->gl_config.double_buffer = 1; | ||
3967 | 234 | video->gl_config.accum_red_size = 0; | ||
3968 | 235 | video->gl_config.accum_green_size = 0; | ||
3969 | 236 | video->gl_config.accum_blue_size = 0; | ||
3970 | 237 | video->gl_config.accum_alpha_size = 0; | ||
3971 | 238 | video->gl_config.stereo = 0; | ||
3972 | 239 | video->gl_config.multisamplebuffers = 0; | ||
3973 | 240 | video->gl_config.multisamplesamples = 0; | ||
3974 | 241 | video->gl_config.accelerated = -1; /* not known, don't set */ | ||
3975 | 242 | video->gl_config.swap_control = -1; /* not known, don't set */ | ||
3976 | 243 | |||
3977 | 244 | /* Initialize the video subsystem */ | ||
3978 | 245 | SDL_memset(&vformat, 0, sizeof(vformat)); | ||
3979 | 246 | if ( video->VideoInit(video, &vformat) < 0 ) { | ||
3980 | 247 | SDL_VideoQuit(); | ||
3981 | 248 | return(-1); | ||
3982 | 249 | } | ||
3983 | 250 | |||
3984 | 251 | /* Create a zero sized video surface of the appropriate format */ | ||
3985 | 252 | video_flags = SDL_SWSURFACE; | ||
3986 | 253 | SDL_VideoSurface = SDL_CreateRGBSurface(video_flags, 0, 0, | ||
3987 | 254 | vformat.BitsPerPixel, | ||
3988 | 255 | vformat.Rmask, vformat.Gmask, vformat.Bmask, 0); | ||
3989 | 256 | if ( SDL_VideoSurface == NULL ) { | ||
3990 | 257 | SDL_VideoQuit(); | ||
3991 | 258 | return(-1); | ||
3992 | 259 | } | ||
3993 | 260 | SDL_PublicSurface = NULL; /* Until SDL_SetVideoMode() */ | ||
3994 | 261 | |||
3995 | 262 | #if 0 /* Don't change the current palette - may be used by other programs. | ||
3996 | 263 | * The application can't do anything with the display surface until | ||
3997 | 264 | * a video mode has been set anyway. :) | ||
3998 | 265 | */ | ||
3999 | 266 | /* If we have a palettized surface, create a default palette */ | ||
4000 | 267 | if ( SDL_VideoSurface->format->palette ) { | ||
4001 | 268 | SDL_PixelFormat *vf = SDL_VideoSurface->format; | ||
4002 | 269 | SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel); | ||
4003 | 270 | video->SetColors(video, | ||
4004 | 271 | 0, vf->palette->ncolors, vf->palette->colors); | ||
4005 | 272 | } | ||
4006 | 273 | #endif | ||
4007 | 274 | video->info.vfmt = SDL_VideoSurface->format; | ||
4008 | 275 | |||
4009 | 276 | /* Start the event loop */ | ||
4010 | 277 | if ( SDL_StartEventLoop(flags) < 0 ) { | ||
4011 | 278 | SDL_VideoQuit(); | ||
4012 | 279 | return(-1); | ||
4013 | 280 | } | ||
4014 | 281 | SDL_CursorInit(flags & SDL_INIT_EVENTTHREAD); | ||
4015 | 282 | |||
4016 | 283 | /* We're ready to go! */ | ||
4017 | 284 | return(0); | ||
4018 | 285 | } | ||
4019 | 286 | |||
4020 | 287 | char *SDL_VideoDriverName(char *namebuf, int maxlen) | ||
4021 | 288 | { | ||
4022 | 289 | if ( current_video != NULL ) { | ||
4023 | 290 | SDL_strlcpy(namebuf, current_video->name, maxlen); | ||
4024 | 291 | return(namebuf); | ||
4025 | 292 | } | ||
4026 | 293 | return(NULL); | ||
4027 | 294 | } | ||
4028 | 295 | |||
4029 | 296 | /* | ||
4030 | 297 | * Get the current display surface | ||
4031 | 298 | */ | ||
4032 | 299 | SDL_Surface *SDL_GetVideoSurface(void) | ||
4033 | 300 | { | ||
4034 | 301 | SDL_Surface *visible; | ||
4035 | 302 | |||
4036 | 303 | visible = NULL; | ||
4037 | 304 | if ( current_video ) { | ||
4038 | 305 | visible = current_video->visible; | ||
4039 | 306 | } | ||
4040 | 307 | return(visible); | ||
4041 | 308 | } | ||
4042 | 309 | |||
4043 | 310 | /* | ||
4044 | 311 | * Get the current information about the video hardware | ||
4045 | 312 | */ | ||
4046 | 313 | const SDL_VideoInfo *SDL_GetVideoInfo(void) | ||
4047 | 314 | { | ||
4048 | 315 | const SDL_VideoInfo *info; | ||
4049 | 316 | |||
4050 | 317 | info = NULL; | ||
4051 | 318 | if ( current_video ) { | ||
4052 | 319 | info = ¤t_video->info; | ||
4053 | 320 | } | ||
4054 | 321 | return(info); | ||
4055 | 322 | } | ||
4056 | 323 | |||
4057 | 324 | /* | ||
4058 | 325 | * Return a pointer to an array of available screen dimensions for the | ||
4059 | 326 | * given format, sorted largest to smallest. Returns NULL if there are | ||
4060 | 327 | * no dimensions available for a particular format, or (SDL_Rect **)-1 | ||
4061 | 328 | * if any dimension is okay for the given format. If 'format' is NULL, | ||
4062 | 329 | * the mode list will be for the format given by SDL_GetVideoInfo()->vfmt | ||
4063 | 330 | */ | ||
4064 | 331 | SDL_Rect ** SDL_ListModes (SDL_PixelFormat *format, Uint32 flags) | ||
4065 | 332 | { | ||
4066 | 333 | SDL_VideoDevice *video = current_video; | ||
4067 | 334 | SDL_VideoDevice *this = current_video; | ||
4068 | 335 | SDL_Rect **modes; | ||
4069 | 336 | |||
4070 | 337 | modes = NULL; | ||
4071 | 338 | if ( SDL_VideoSurface ) { | ||
4072 | 339 | if ( format == NULL ) { | ||
4073 | 340 | format = SDL_VideoSurface->format; | ||
4074 | 341 | } | ||
4075 | 342 | modes = video->ListModes(this, format, flags); | ||
4076 | 343 | } | ||
4077 | 344 | return(modes); | ||
4078 | 345 | } | ||
4079 | 346 | |||
4080 | 347 | /* | ||
4081 | 348 | * Check to see if a particular video mode is supported. | ||
4082 | 349 | * It returns 0 if the requested mode is not supported under any bit depth, | ||
4083 | 350 | * or returns the bits-per-pixel of the closest available mode with the | ||
4084 | 351 | * given width and height. If this bits-per-pixel is different from the | ||
4085 | 352 | * one used when setting the video mode, SDL_SetVideoMode() will succeed, | ||
4086 | 353 | * but will emulate the requested bits-per-pixel with a shadow surface. | ||
4087 | 354 | */ | ||
4088 | 355 | static Uint8 SDL_closest_depths[4][8] = { | ||
4089 | 356 | /* 8 bit closest depth ordering */ | ||
4090 | 357 | { 0, 8, 16, 15, 32, 24, 0, 0 }, | ||
4091 | 358 | /* 15,16 bit closest depth ordering */ | ||
4092 | 359 | { 0, 16, 15, 32, 24, 8, 0, 0 }, | ||
4093 | 360 | /* 24 bit closest depth ordering */ | ||
4094 | 361 | { 0, 24, 32, 16, 15, 8, 0, 0 }, | ||
4095 | 362 | /* 32 bit closest depth ordering */ | ||
4096 | 363 | { 0, 32, 16, 15, 24, 8, 0, 0 } | ||
4097 | 364 | }; | ||
4098 | 365 | |||
4099 | 366 | |||
4100 | 367 | #ifdef __MACOS__ /* MPW optimization bug? */ | ||
4101 | 368 | #define NEGATIVE_ONE 0xFFFFFFFF | ||
4102 | 369 | #else | ||
4103 | 370 | #define NEGATIVE_ONE -1 | ||
4104 | 371 | #endif | ||
4105 | 372 | |||
4106 | 373 | int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) | ||
4107 | 374 | { | ||
4108 | 375 | int table, b, i; | ||
4109 | 376 | int supported; | ||
4110 | 377 | SDL_PixelFormat format; | ||
4111 | 378 | SDL_Rect **sizes; | ||
4112 | 379 | |||
4113 | 380 | /* Currently 1 and 4 bpp are not supported */ | ||
4114 | 381 | if ( bpp < 8 || bpp > 32 ) { | ||
4115 | 382 | return(0); | ||
4116 | 383 | } | ||
4117 | 384 | if ( (width <= 0) || (height <= 0) ) { | ||
4118 | 385 | return(0); | ||
4119 | 386 | } | ||
4120 | 387 | |||
4121 | 388 | /* Search through the list valid of modes */ | ||
4122 | 389 | SDL_memset(&format, 0, sizeof(format)); | ||
4123 | 390 | supported = 0; | ||
4124 | 391 | table = ((bpp+7)/8)-1; | ||
4125 | 392 | SDL_closest_depths[table][0] = bpp; | ||
4126 | 393 | SDL_closest_depths[table][7] = 0; | ||
4127 | 394 | for ( b = 0; !supported && SDL_closest_depths[table][b]; ++b ) { | ||
4128 | 395 | format.BitsPerPixel = SDL_closest_depths[table][b]; | ||
4129 | 396 | sizes = SDL_ListModes(&format, flags); | ||
4130 | 397 | if ( sizes == (SDL_Rect **)0 ) { | ||
4131 | 398 | /* No sizes supported at this bit-depth */ | ||
4132 | 399 | continue; | ||
4133 | 400 | } else | ||
4134 | 401 | if (sizes == (SDL_Rect **)NEGATIVE_ONE) { | ||
4135 | 402 | /* Any size supported at this bit-depth */ | ||
4136 | 403 | supported = 1; | ||
4137 | 404 | continue; | ||
4138 | 405 | } else if (current_video->handles_any_size) { | ||
4139 | 406 | /* Driver can center a smaller surface to simulate fullscreen */ | ||
4140 | 407 | for ( i=0; sizes[i]; ++i ) { | ||
4141 | 408 | if ((sizes[i]->w >= width) && (sizes[i]->h >= height)) { | ||
4142 | 409 | supported = 1; /* this mode can fit the centered window. */ | ||
4143 | 410 | break; | ||
4144 | 411 | } | ||
4145 | 412 | } | ||
4146 | 413 | } else | ||
4147 | 414 | for ( i=0; sizes[i]; ++i ) { | ||
4148 | 415 | if ((sizes[i]->w == width) && (sizes[i]->h == height)) { | ||
4149 | 416 | supported = 1; | ||
4150 | 417 | break; | ||
4151 | 418 | } | ||
4152 | 419 | } | ||
4153 | 420 | } | ||
4154 | 421 | if ( supported ) { | ||
4155 | 422 | --b; | ||
4156 | 423 | return(SDL_closest_depths[table][b]); | ||
4157 | 424 | } else { | ||
4158 | 425 | return(0); | ||
4159 | 426 | } | ||
4160 | 427 | } | ||
4161 | 428 | |||
4162 | 429 | /* | ||
4163 | 430 | * Get the closest non-emulated video mode to the one requested | ||
4164 | 431 | */ | ||
4165 | 432 | static int SDL_GetVideoMode (int *w, int *h, int *BitsPerPixel, Uint32 flags) | ||
4166 | 433 | { | ||
4167 | 434 | int table, b, i; | ||
4168 | 435 | int supported; | ||
4169 | 436 | int native_bpp; | ||
4170 | 437 | SDL_PixelFormat format; | ||
4171 | 438 | SDL_Rect **sizes; | ||
4172 | 439 | |||
4173 | 440 | /* Check parameters */ | ||
4174 | 441 | if ( *BitsPerPixel < 8 || *BitsPerPixel > 32 ) { | ||
4175 | 442 | SDL_SetError("Invalid bits per pixel (range is {8...32})"); | ||
4176 | 443 | return(0); | ||
4177 | 444 | } | ||
4178 | 445 | if ((*w <= 0) || (*h <= 0)) { | ||
4179 | 446 | SDL_SetError("Invalid width or height"); | ||
4180 | 447 | return(0); | ||
4181 | 448 | } | ||
4182 | 449 | |||
4183 | 450 | /* Try the original video mode, get the closest depth */ | ||
4184 | 451 | native_bpp = SDL_VideoModeOK(*w, *h, *BitsPerPixel, flags); | ||
4185 | 452 | if ( native_bpp == *BitsPerPixel ) { | ||
4186 | 453 | return(1); | ||
4187 | 454 | } | ||
4188 | 455 | if ( native_bpp > 0 ) { | ||
4189 | 456 | *BitsPerPixel = native_bpp; | ||
4190 | 457 | return(1); | ||
4191 | 458 | } | ||
4192 | 459 | |||
4193 | 460 | /* No exact size match at any depth, look for closest match */ | ||
4194 | 461 | SDL_memset(&format, 0, sizeof(format)); | ||
4195 | 462 | supported = 0; | ||
4196 | 463 | table = ((*BitsPerPixel+7)/8)-1; | ||
4197 | 464 | SDL_closest_depths[table][0] = *BitsPerPixel; | ||
4198 | 465 | SDL_closest_depths[table][7] = SDL_VideoSurface->format->BitsPerPixel; | ||
4199 | 466 | for ( b = 0; !supported && SDL_closest_depths[table][b]; ++b ) { | ||
4200 | 467 | int best; | ||
4201 | 468 | |||
4202 | 469 | format.BitsPerPixel = SDL_closest_depths[table][b]; | ||
4203 | 470 | sizes = SDL_ListModes(&format, flags); | ||
4204 | 471 | if ( sizes == (SDL_Rect **)0 ) { | ||
4205 | 472 | /* No sizes supported at this bit-depth */ | ||
4206 | 473 | continue; | ||
4207 | 474 | } | ||
4208 | 475 | best=0; | ||
4209 | 476 | for ( i=0; sizes[i]; ++i ) { | ||
4210 | 477 | /* Mode with both dimensions bigger or equal than asked ? */ | ||
4211 | 478 | if ((sizes[i]->w >= *w) && (sizes[i]->h >= *h)) { | ||
4212 | 479 | /* Mode with any dimension smaller or equal than current best ? */ | ||
4213 | 480 | if ((sizes[i]->w <= sizes[best]->w) || (sizes[i]->h <= sizes[best]->h)) { | ||
4214 | 481 | /* Now choose the mode that has less pixels */ | ||
4215 | 482 | if ((sizes[i]->w * sizes[i]->h) <= (sizes[best]->w * sizes[best]->h)) { | ||
4216 | 483 | best=i; | ||
4217 | 484 | supported = 1; | ||
4218 | 485 | } | ||
4219 | 486 | } | ||
4220 | 487 | } | ||
4221 | 488 | } | ||
4222 | 489 | if (supported) { | ||
4223 | 490 | *w=sizes[best]->w; | ||
4224 | 491 | *h=sizes[best]->h; | ||
4225 | 492 | *BitsPerPixel = SDL_closest_depths[table][b]; | ||
4226 | 493 | } | ||
4227 | 494 | } | ||
4228 | 495 | if ( ! supported ) { | ||
4229 | 496 | SDL_SetError("No video mode large enough for %dx%d", *w, *h); | ||
4230 | 497 | } | ||
4231 | 498 | return(supported); | ||
4232 | 499 | } | ||
4233 | 500 | |||
4234 | 501 | /* This should probably go somewhere else -- like SDL_surface.c */ | ||
4235 | 502 | static void SDL_ClearSurface(SDL_Surface *surface) | ||
4236 | 503 | { | ||
4237 | 504 | Uint32 black; | ||
4238 | 505 | |||
4239 | 506 | black = SDL_MapRGB(surface->format, 0, 0, 0); | ||
4240 | 507 | SDL_FillRect(surface, NULL, black); | ||
4241 | 508 | if ((surface->flags&SDL_HWSURFACE) && (surface->flags&SDL_DOUBLEBUF)) { | ||
4242 | 509 | SDL_Flip(surface); | ||
4243 | 510 | SDL_FillRect(surface, NULL, black); | ||
4244 | 511 | } | ||
4245 | 512 | if (surface->flags&SDL_FULLSCREEN) { | ||
4246 | 513 | SDL_Flip(surface); | ||
4247 | 514 | } | ||
4248 | 515 | } | ||
4249 | 516 | |||
4250 | 517 | /* | ||
4251 | 518 | * Create a shadow surface suitable for fooling the app. :-) | ||
4252 | 519 | */ | ||
4253 | 520 | static void SDL_CreateShadowSurface(int depth) | ||
4254 | 521 | { | ||
4255 | 522 | Uint32 Rmask, Gmask, Bmask; | ||
4256 | 523 | |||
4257 | 524 | /* Allocate the shadow surface */ | ||
4258 | 525 | if ( depth == (SDL_VideoSurface->format)->BitsPerPixel ) { | ||
4259 | 526 | Rmask = (SDL_VideoSurface->format)->Rmask; | ||
4260 | 527 | Gmask = (SDL_VideoSurface->format)->Gmask; | ||
4261 | 528 | Bmask = (SDL_VideoSurface->format)->Bmask; | ||
4262 | 529 | } else { | ||
4263 | 530 | Rmask = Gmask = Bmask = 0; | ||
4264 | 531 | } | ||
4265 | 532 | SDL_ShadowSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, | ||
4266 | 533 | SDL_VideoSurface->w, SDL_VideoSurface->h, | ||
4267 | 534 | depth, Rmask, Gmask, Bmask, 0); | ||
4268 | 535 | if ( SDL_ShadowSurface == NULL ) { | ||
4269 | 536 | return; | ||
4270 | 537 | } | ||
4271 | 538 | |||
4272 | 539 | /* 8-bit shadow surfaces report that they have exclusive palette */ | ||
4273 | 540 | if ( SDL_ShadowSurface->format->palette ) { | ||
4274 | 541 | SDL_ShadowSurface->flags |= SDL_HWPALETTE; | ||
4275 | 542 | if ( depth == (SDL_VideoSurface->format)->BitsPerPixel ) { | ||
4276 | 543 | SDL_memcpy(SDL_ShadowSurface->format->palette->colors, | ||
4277 | 544 | SDL_VideoSurface->format->palette->colors, | ||
4278 | 545 | SDL_VideoSurface->format->palette->ncolors* | ||
4279 | 546 | sizeof(SDL_Color)); | ||
4280 | 547 | } else { | ||
4281 | 548 | SDL_DitherColors( | ||
4282 | 549 | SDL_ShadowSurface->format->palette->colors, depth); | ||
4283 | 550 | } | ||
4284 | 551 | } | ||
4285 | 552 | |||
4286 | 553 | /* If the video surface is resizable, the shadow should say so */ | ||
4287 | 554 | if ( (SDL_VideoSurface->flags & SDL_RESIZABLE) == SDL_RESIZABLE ) { | ||
4288 | 555 | SDL_ShadowSurface->flags |= SDL_RESIZABLE; | ||
4289 | 556 | } | ||
4290 | 557 | /* If the video surface has no frame, the shadow should say so */ | ||
4291 | 558 | if ( (SDL_VideoSurface->flags & SDL_NOFRAME) == SDL_NOFRAME ) { | ||
4292 | 559 | SDL_ShadowSurface->flags |= SDL_NOFRAME; | ||
4293 | 560 | } | ||
4294 | 561 | /* If the video surface is fullscreen, the shadow should say so */ | ||
4295 | 562 | if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { | ||
4296 | 563 | SDL_ShadowSurface->flags |= SDL_FULLSCREEN; | ||
4297 | 564 | } | ||
4298 | 565 | /* If the video surface is flippable, the shadow should say so */ | ||
4299 | 566 | if ( (SDL_VideoSurface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) { | ||
4300 | 567 | SDL_ShadowSurface->flags |= SDL_DOUBLEBUF; | ||
4301 | 568 | } | ||
4302 | 569 | return; | ||
4303 | 570 | } | ||
4304 | 571 | |||
4305 | 572 | #ifdef __QNXNTO__ | ||
4306 | 573 | #include <sys/neutrino.h> | ||
4307 | 574 | #endif /* __QNXNTO__ */ | ||
4308 | 575 | |||
4309 | 576 | #ifdef WIN32 | ||
4310 | 577 | extern int sysevents_mouse_pressed; | ||
4311 | 578 | #endif | ||
4312 | 579 | |||
4313 | 580 | /* | ||
4314 | 581 | * Set the requested video mode, allocating a shadow buffer if necessary. | ||
4315 | 582 | */ | ||
4316 | 583 | SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) | ||
4317 | 584 | { | ||
4318 | 585 | SDL_VideoDevice *video, *this; | ||
4319 | 586 | SDL_Surface *prev_mode, *mode; | ||
4320 | 587 | int video_w; | ||
4321 | 588 | int video_h; | ||
4322 | 589 | int video_bpp; | ||
4323 | 590 | int is_opengl; | ||
4324 | 591 | SDL_GrabMode saved_grab; | ||
4325 | 592 | |||
4326 | 593 | #ifdef WIN32 | ||
4327 | 594 | sysevents_mouse_pressed = 0; | ||
4328 | 595 | #endif | ||
4329 | 596 | |||
4330 | 597 | /* Start up the video driver, if necessary.. | ||
4331 | 598 | WARNING: This is the only function protected this way! | ||
4332 | 599 | */ | ||
4333 | 600 | if ( ! current_video ) { | ||
4334 | 601 | if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE) < 0 ) { | ||
4335 | 602 | return(NULL); | ||
4336 | 603 | } | ||
4337 | 604 | } | ||
4338 | 605 | this = video = current_video; | ||
4339 | 606 | |||
4340 | 607 | /* Default to the current width and height */ | ||
4341 | 608 | if ( width == 0 ) { | ||
4342 | 609 | width = video->info.current_w; | ||
4343 | 610 | } | ||
4344 | 611 | if ( height == 0 ) { | ||
4345 | 612 | height = video->info.current_h; | ||
4346 | 613 | } | ||
4347 | 614 | /* Default to the current video bpp */ | ||
4348 | 615 | if ( bpp == 0 ) { | ||
4349 | 616 | flags |= SDL_ANYFORMAT; | ||
4350 | 617 | bpp = SDL_VideoSurface->format->BitsPerPixel; | ||
4351 | 618 | } | ||
4352 | 619 | |||
4353 | 620 | /* Get a good video mode, the closest one possible */ | ||
4354 | 621 | video_w = width; | ||
4355 | 622 | video_h = height; | ||
4356 | 623 | video_bpp = bpp; | ||
4357 | 624 | if ( ! SDL_GetVideoMode(&video_w, &video_h, &video_bpp, flags) ) { | ||
4358 | 625 | return(NULL); | ||
4359 | 626 | } | ||
4360 | 627 | |||
4361 | 628 | /* Check the requested flags */ | ||
4362 | 629 | /* There's no palette in > 8 bits-per-pixel mode */ | ||
4363 | 630 | if ( video_bpp > 8 ) { | ||
4364 | 631 | flags &= ~SDL_HWPALETTE; | ||
4365 | 632 | } | ||
4366 | 633 | #if 0 | ||
4367 | 634 | if ( (flags&SDL_FULLSCREEN) != SDL_FULLSCREEN ) { | ||
4368 | 635 | /* There's no windowed double-buffering */ | ||
4369 | 636 | flags &= ~SDL_DOUBLEBUF; | ||
4370 | 637 | } | ||
4371 | 638 | #endif | ||
4372 | 639 | if ( (flags&SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) { | ||
4373 | 640 | /* Use hardware surfaces when double-buffering */ | ||
4374 | 641 | flags |= SDL_HWSURFACE; | ||
4375 | 642 | } | ||
4376 | 643 | |||
4377 | 644 | is_opengl = ( ( flags & SDL_OPENGL ) == SDL_OPENGL ); | ||
4378 | 645 | if ( is_opengl ) { | ||
4379 | 646 | /* These flags are for 2D video modes only */ | ||
4380 | 647 | flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF); | ||
4381 | 648 | } | ||
4382 | 649 | |||
4383 | 650 | /* Reset the keyboard here so event callbacks can run */ | ||
4384 | 651 | SDL_ResetKeyboard(); | ||
4385 | 652 | SDL_ResetMouse(); | ||
4386 | 653 | SDL_SetMouseRange(width, height); | ||
4387 | 654 | SDL_cursorstate &= ~CURSOR_USINGSW; | ||
4388 | 655 | |||
4389 | 656 | /* Clean up any previous video mode */ | ||
4390 | 657 | if ( SDL_PublicSurface != NULL ) { | ||
4391 | 658 | SDL_PublicSurface = NULL; | ||
4392 | 659 | } | ||
4393 | 660 | if ( SDL_ShadowSurface != NULL ) { | ||
4394 | 661 | SDL_Surface *ready_to_go; | ||
4395 | 662 | ready_to_go = SDL_ShadowSurface; | ||
4396 | 663 | SDL_ShadowSurface = NULL; | ||
4397 | 664 | SDL_FreeSurface(ready_to_go); | ||
4398 | 665 | } | ||
4399 | 666 | if ( video->physpal ) { | ||
4400 | 667 | SDL_free(video->physpal->colors); | ||
4401 | 668 | SDL_free(video->physpal); | ||
4402 | 669 | video->physpal = NULL; | ||
4403 | 670 | } | ||
4404 | 671 | if( video->gammacols) { | ||
4405 | 672 | SDL_free(video->gammacols); | ||
4406 | 673 | video->gammacols = NULL; | ||
4407 | 674 | } | ||
4408 | 675 | |||
4409 | 676 | /* Save the previous grab state and turn off grab for mode switch */ | ||
4410 | 677 | saved_grab = SDL_WM_GrabInputOff(); | ||
4411 | 678 | |||
4412 | 679 | /* Try to set the video mode, along with offset and clipping */ | ||
4413 | 680 | prev_mode = SDL_VideoSurface; | ||
4414 | 681 | SDL_LockCursor(); | ||
4415 | 682 | SDL_VideoSurface = NULL; /* In case it's freed by driver */ | ||
4416 | 683 | mode = video->SetVideoMode(this, prev_mode,video_w,video_h,video_bpp,flags); | ||
4417 | 684 | if ( mode ) { /* Prevent resize events from mode change */ | ||
4418 | 685 | /* But not on OS/2 */ | ||
4419 | 686 | #ifndef __OS2__ | ||
4420 | 687 | SDL_PrivateResize(mode->w, mode->h); | ||
4421 | 688 | #endif | ||
4422 | 689 | |||
4423 | 690 | /* Sam - If we asked for OpenGL mode, and didn't get it, fail */ | ||
4424 | 691 | if ( is_opengl && !(mode->flags & SDL_OPENGL) ) { | ||
4425 | 692 | mode = NULL; | ||
4426 | 693 | SDL_SetError("OpenGL not available"); | ||
4427 | 694 | } | ||
4428 | 695 | } | ||
4429 | 696 | /* | ||
4430 | 697 | * rcg11292000 | ||
4431 | 698 | * If you try to set an SDL_OPENGL surface, and fail to find a | ||
4432 | 699 | * matching visual, then the next call to SDL_SetVideoMode() | ||
4433 | 700 | * will segfault, since we no longer point to a dummy surface, | ||
4434 | 701 | * but rather NULL. | ||
4435 | 702 | * Sam 11/29/00 | ||
4436 | 703 | * WARNING, we need to make sure that the previous mode hasn't | ||
4437 | 704 | * already been freed by the video driver. What do we do in | ||
4438 | 705 | * that case? Should we call SDL_VideoInit() again? | ||
4439 | 706 | */ | ||
4440 | 707 | SDL_VideoSurface = (mode != NULL) ? mode : prev_mode; | ||
4441 | 708 | |||
4442 | 709 | if ( (mode != NULL) && (!is_opengl) ) { | ||
4443 | 710 | /* Sanity check */ | ||
4444 | 711 | if ( (mode->w < width) || (mode->h < height) ) { | ||
4445 | 712 | SDL_SetError("Video mode smaller than requested"); | ||
4446 | 713 | return(NULL); | ||
4447 | 714 | } | ||
4448 | 715 | |||
4449 | 716 | /* If we have a palettized surface, create a default palette */ | ||
4450 | 717 | if ( mode->format->palette ) { | ||
4451 | 718 | SDL_PixelFormat *vf = mode->format; | ||
4452 | 719 | SDL_DitherColors(vf->palette->colors, vf->BitsPerPixel); | ||
4453 | 720 | video->SetColors(this, 0, vf->palette->ncolors, | ||
4454 | 721 | vf->palette->colors); | ||
4455 | 722 | } | ||
4456 | 723 | |||
4457 | 724 | /* Clear the surface to black */ | ||
4458 | 725 | video->offset_x = 0; | ||
4459 | 726 | video->offset_y = 0; | ||
4460 | 727 | mode->offset = 0; | ||
4461 | 728 | SDL_SetClipRect(mode, NULL); | ||
4462 | 729 | SDL_ClearSurface(mode); | ||
4463 | 730 | |||
4464 | 731 | /* Now adjust the offsets to match the desired mode */ | ||
4465 | 732 | video->offset_x = (mode->w-width)/2; | ||
4466 | 733 | video->offset_y = (mode->h-height)/2; | ||
4467 | 734 | mode->offset = video->offset_y*mode->pitch + | ||
4468 | 735 | video->offset_x*mode->format->BytesPerPixel; | ||
4469 | 736 | #ifdef DEBUG_VIDEO | ||
4470 | 737 | fprintf(stderr, | ||
4471 | 738 | "Requested mode: %dx%dx%d, obtained mode %dx%dx%d (offset %d)\n", | ||
4472 | 739 | width, height, bpp, | ||
4473 | 740 | mode->w, mode->h, mode->format->BitsPerPixel, mode->offset); | ||
4474 | 741 | #endif | ||
4475 | 742 | mode->w = width; | ||
4476 | 743 | mode->h = height; | ||
4477 | 744 | SDL_SetClipRect(mode, NULL); | ||
4478 | 745 | } | ||
4479 | 746 | SDL_ResetCursor(); | ||
4480 | 747 | SDL_UnlockCursor(); | ||
4481 | 748 | |||
4482 | 749 | /* If we failed setting a video mode, return NULL... (Uh Oh!) */ | ||
4483 | 750 | if ( mode == NULL ) { | ||
4484 | 751 | return(NULL); | ||
4485 | 752 | } | ||
4486 | 753 | |||
4487 | 754 | /* If there is no window manager, set the SDL_NOFRAME flag */ | ||
4488 | 755 | if ( ! video->info.wm_available ) { | ||
4489 | 756 | mode->flags |= SDL_NOFRAME; | ||
4490 | 757 | } | ||
4491 | 758 | |||
4492 | 759 | /* Reset the mouse cursor and grab for new video mode */ | ||
4493 | 760 | SDL_SetCursor(NULL); | ||
4494 | 761 | if ( video->UpdateMouse ) { | ||
4495 | 762 | video->UpdateMouse(this); | ||
4496 | 763 | } | ||
4497 | 764 | SDL_WM_GrabInput(saved_grab); | ||
4498 | 765 | SDL_GetRelativeMouseState(NULL, NULL); /* Clear first large delta */ | ||
4499 | 766 | |||
4500 | 767 | #if SDL_VIDEO_OPENGL | ||
4501 | 768 | /* Load GL symbols (before MakeCurrent, where we need glGetString). */ | ||
4502 | 769 | if ( flags & (SDL_OPENGL | SDL_OPENGLBLIT) ) { | ||
4503 | 770 | |||
4504 | 771 | #if defined(__QNXNTO__) && (_NTO_VERSION < 630) | ||
4505 | 772 | #define __SDL_NOGETPROCADDR__ | ||
4506 | 773 | #elif defined(__MINT__) | ||
4507 | 774 | #define __SDL_NOGETPROCADDR__ | ||
4508 | 775 | #endif | ||
4509 | 776 | #ifdef __SDL_NOGETPROCADDR__ | ||
4510 | 777 | #define SDL_PROC(ret,func,params) video->func=func; | ||
4511 | 778 | #else | ||
4512 | 779 | #define SDL_PROC(ret,func,params) \ | ||
4513 | 780 | do { \ | ||
4514 | 781 | video->func = SDL_GL_GetProcAddress(#func); \ | ||
4515 | 782 | if ( ! video->func ) { \ | ||
4516 | 783 | SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ | ||
4517 | 784 | return(NULL); \ | ||
4518 | 785 | } \ | ||
4519 | 786 | } while ( 0 ); | ||
4520 | 787 | |||
4521 | 788 | #endif /* __SDL_NOGETPROCADDR__ */ | ||
4522 | 789 | |||
4523 | 790 | #include "SDL_glfuncs.h" | ||
4524 | 791 | #undef SDL_PROC | ||
4525 | 792 | } | ||
4526 | 793 | #endif /* SDL_VIDEO_OPENGL */ | ||
4527 | 794 | |||
4528 | 795 | /* If we're running OpenGL, make the context current */ | ||
4529 | 796 | if ( (video->screen->flags & SDL_OPENGL) && | ||
4530 | 797 | video->GL_MakeCurrent ) { | ||
4531 | 798 | if ( video->GL_MakeCurrent(this) < 0 ) { | ||
4532 | 799 | return(NULL); | ||
4533 | 800 | } | ||
4534 | 801 | } | ||
4535 | 802 | |||
4536 | 803 | /* Set up a fake SDL surface for OpenGL "blitting" */ | ||
4537 | 804 | if ( (flags & SDL_OPENGLBLIT) == SDL_OPENGLBLIT ) { | ||
4538 | 805 | /* Load GL functions for performing the texture updates */ | ||
4539 | 806 | #if SDL_VIDEO_OPENGL | ||
4540 | 807 | |||
4541 | 808 | /* Create a software surface for blitting */ | ||
4542 | 809 | #ifdef GL_VERSION_1_2 | ||
4543 | 810 | /* If the implementation either supports the packed pixels | ||
4544 | 811 | extension, or implements the core OpenGL 1.2 API, it will | ||
4545 | 812 | support the GL_UNSIGNED_SHORT_5_6_5 texture format. | ||
4546 | 813 | */ | ||
4547 | 814 | if ( (bpp == 16) && | ||
4548 | 815 | (SDL_strstr((const char *)video->glGetString(GL_EXTENSIONS), "GL_EXT_packed_pixels") || | ||
4549 | 816 | (SDL_atof((const char *)video->glGetString(GL_VERSION)) >= 1.2f)) | ||
4550 | 817 | ) { | ||
4551 | 818 | video->is_32bit = 0; | ||
4552 | 819 | SDL_VideoSurface = SDL_CreateRGBSurface( | ||
4553 | 820 | flags, | ||
4554 | 821 | width, | ||
4555 | 822 | height, | ||
4556 | 823 | 16, | ||
4557 | 824 | 31 << 11, | ||
4558 | 825 | 63 << 5, | ||
4559 | 826 | 31, | ||
4560 | 827 | 0 | ||
4561 | 828 | ); | ||
4562 | 829 | } | ||
4563 | 830 | else | ||
4564 | 831 | #endif /* OpenGL 1.2 */ | ||
4565 | 832 | { | ||
4566 | 833 | video->is_32bit = 1; | ||
4567 | 834 | SDL_VideoSurface = SDL_CreateRGBSurface( | ||
4568 | 835 | flags, | ||
4569 | 836 | width, | ||
4570 | 837 | height, | ||
4571 | 838 | 32, | ||
4572 | 839 | #if SDL_BYTEORDER == SDL_LIL_ENDIAN | ||
4573 | 840 | 0x000000FF, | ||
4574 | 841 | 0x0000FF00, | ||
4575 | 842 | 0x00FF0000, | ||
4576 | 843 | 0xFF000000 | ||
4577 | 844 | #else | ||
4578 | 845 | 0xFF000000, | ||
4579 | 846 | 0x00FF0000, | ||
4580 | 847 | 0x0000FF00, | ||
4581 | 848 | 0x000000FF | ||
4582 | 849 | #endif | ||
4583 | 850 | ); | ||
4584 | 851 | } | ||
4585 | 852 | if ( ! SDL_VideoSurface ) { | ||
4586 | 853 | return(NULL); | ||
4587 | 854 | } | ||
4588 | 855 | SDL_VideoSurface->flags = mode->flags | SDL_OPENGLBLIT; | ||
4589 | 856 | |||
4590 | 857 | /* Free the original video mode surface (is this safe?) */ | ||
4591 | 858 | SDL_FreeSurface(mode); | ||
4592 | 859 | |||
4593 | 860 | /* Set the surface completely opaque & white by default */ | ||
4594 | 861 | SDL_memset( SDL_VideoSurface->pixels, 255, SDL_VideoSurface->h * SDL_VideoSurface->pitch ); | ||
4595 | 862 | video->glGenTextures( 1, &video->texture ); | ||
4596 | 863 | video->glBindTexture( GL_TEXTURE_2D, video->texture ); | ||
4597 | 864 | video->glTexImage2D( | ||
4598 | 865 | GL_TEXTURE_2D, | ||
4599 | 866 | 0, | ||
4600 | 867 | video->is_32bit ? GL_RGBA : GL_RGB, | ||
4601 | 868 | 256, | ||
4602 | 869 | 256, | ||
4603 | 870 | 0, | ||
4604 | 871 | video->is_32bit ? GL_RGBA : GL_RGB, | ||
4605 | 872 | #ifdef GL_VERSION_1_2 | ||
4606 | 873 | video->is_32bit ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5, | ||
4607 | 874 | #else | ||
4608 | 875 | GL_UNSIGNED_BYTE, | ||
4609 | 876 | #endif | ||
4610 | 877 | NULL); | ||
4611 | 878 | |||
4612 | 879 | video->UpdateRects = SDL_GL_UpdateRectsLock; | ||
4613 | 880 | #else | ||
4614 | 881 | SDL_SetError("Somebody forgot to #define SDL_VIDEO_OPENGL"); | ||
4615 | 882 | return(NULL); | ||
4616 | 883 | #endif | ||
4617 | 884 | } | ||
4618 | 885 | |||
4619 | 886 | /* Create a shadow surface if necessary */ | ||
4620 | 887 | /* There are three conditions under which we create a shadow surface: | ||
4621 | 888 | 1. We need a particular bits-per-pixel that we didn't get. | ||
4622 | 889 | 2. We need a hardware palette and didn't get one. | ||
4623 | 890 | 3. We need a software surface and got a hardware surface. | ||
4624 | 891 | */ | ||
4625 | 892 | if ( !(SDL_VideoSurface->flags & SDL_OPENGL) && | ||
4626 | 893 | ( | ||
4627 | 894 | ( !(flags&SDL_ANYFORMAT) && | ||
4628 | 895 | (SDL_VideoSurface->format->BitsPerPixel != bpp)) || | ||
4629 | 896 | ( (flags&SDL_HWPALETTE) && | ||
4630 | 897 | !(SDL_VideoSurface->flags&SDL_HWPALETTE)) || | ||
4631 | 898 | /* If the surface is in hardware, video writes are visible | ||
4632 | 899 | as soon as they are performed, so we need to buffer them | ||
4633 | 900 | */ | ||
4634 | 901 | ( ((flags&SDL_HWSURFACE) == SDL_SWSURFACE) && | ||
4635 | 902 | (SDL_VideoSurface->flags&SDL_HWSURFACE)) || | ||
4636 | 903 | ( (flags&SDL_DOUBLEBUF) && | ||
4637 | 904 | (SDL_VideoSurface->flags&SDL_HWSURFACE) && | ||
4638 | 905 | !(SDL_VideoSurface->flags&SDL_DOUBLEBUF)) | ||
4639 | 906 | ) ) { | ||
4640 | 907 | SDL_CreateShadowSurface(bpp); | ||
4641 | 908 | if ( SDL_ShadowSurface == NULL ) { | ||
4642 | 909 | SDL_SetError("Couldn't create shadow surface"); | ||
4643 | 910 | return(NULL); | ||
4644 | 911 | } | ||
4645 | 912 | SDL_PublicSurface = SDL_ShadowSurface; | ||
4646 | 913 | } else { | ||
4647 | 914 | SDL_PublicSurface = SDL_VideoSurface; | ||
4648 | 915 | } | ||
4649 | 916 | video->info.vfmt = SDL_VideoSurface->format; | ||
4650 | 917 | video->info.current_w = SDL_VideoSurface->w; | ||
4651 | 918 | video->info.current_h = SDL_VideoSurface->h; | ||
4652 | 919 | |||
4653 | 920 | /* We're done! */ | ||
4654 | 921 | return(SDL_PublicSurface); | ||
4655 | 922 | } | ||
4656 | 923 | |||
4657 | 924 | /* | ||
4658 | 925 | * Convert a surface into the video pixel format. | ||
4659 | 926 | */ | ||
4660 | 927 | SDL_Surface * SDL_DisplayFormat (SDL_Surface *surface) | ||
4661 | 928 | { | ||
4662 | 929 | Uint32 flags; | ||
4663 | 930 | |||
4664 | 931 | if ( ! SDL_PublicSurface ) { | ||
4665 | 932 | SDL_SetError("No video mode has been set"); | ||
4666 | 933 | return(NULL); | ||
4667 | 934 | } | ||
4668 | 935 | /* Set the flags appropriate for copying to display surface */ | ||
4669 | 936 | if (((SDL_PublicSurface->flags&SDL_HWSURFACE) == SDL_HWSURFACE) && current_video->info.blit_hw) | ||
4670 | 937 | flags = SDL_HWSURFACE; | ||
4671 | 938 | else | ||
4672 | 939 | flags = SDL_SWSURFACE; | ||
4673 | 940 | #ifdef AUTORLE_DISPLAYFORMAT | ||
4674 | 941 | flags |= (surface->flags & (SDL_SRCCOLORKEY|SDL_SRCALPHA)); | ||
4675 | 942 | flags |= SDL_RLEACCELOK; | ||
4676 | 943 | #else | ||
4677 | 944 | flags |= surface->flags & (SDL_SRCCOLORKEY|SDL_SRCALPHA|SDL_RLEACCELOK); | ||
4678 | 945 | #endif | ||
4679 | 946 | return(SDL_ConvertSurface(surface, SDL_PublicSurface->format, flags)); | ||
4680 | 947 | } | ||
4681 | 948 | |||
4682 | 949 | /* | ||
4683 | 950 | * Convert a surface into a format that's suitable for blitting to | ||
4684 | 951 | * the screen, but including an alpha channel. | ||
4685 | 952 | */ | ||
4686 | 953 | SDL_Surface *SDL_DisplayFormatAlpha(SDL_Surface *surface) | ||
4687 | 954 | { | ||
4688 | 955 | SDL_PixelFormat *vf; | ||
4689 | 956 | SDL_PixelFormat *format; | ||
4690 | 957 | SDL_Surface *converted; | ||
4691 | 958 | Uint32 flags; | ||
4692 | 959 | /* default to ARGB8888 */ | ||
4693 | 960 | Uint32 amask = 0xff000000; | ||
4694 | 961 | Uint32 rmask = 0x00ff0000; | ||
4695 | 962 | Uint32 gmask = 0x0000ff00; | ||
4696 | 963 | Uint32 bmask = 0x000000ff; | ||
4697 | 964 | |||
4698 | 965 | if ( ! SDL_PublicSurface ) { | ||
4699 | 966 | SDL_SetError("No video mode has been set"); | ||
4700 | 967 | return(NULL); | ||
4701 | 968 | } | ||
4702 | 969 | vf = SDL_PublicSurface->format; | ||
4703 | 970 | |||
4704 | 971 | switch(vf->BytesPerPixel) { | ||
4705 | 972 | case 2: | ||
4706 | 973 | /* For XGY5[56]5, use, AXGY8888, where {X, Y} = {R, B}. | ||
4707 | 974 | For anything else (like ARGB4444) it doesn't matter | ||
4708 | 975 | since we have no special code for it anyway */ | ||
4709 | 976 | if ( (vf->Rmask == 0x1f) && | ||
4710 | 977 | (vf->Bmask == 0xf800 || vf->Bmask == 0x7c00)) { | ||
4711 | 978 | rmask = 0xff; | ||
4712 | 979 | bmask = 0xff0000; | ||
4713 | 980 | } | ||
4714 | 981 | break; | ||
4715 | 982 | |||
4716 | 983 | case 3: | ||
4717 | 984 | case 4: | ||
4718 | 985 | /* Keep the video format, as long as the high 8 bits are | ||
4719 | 986 | unused or alpha */ | ||
4720 | 987 | if ( (vf->Rmask == 0xff) && (vf->Bmask == 0xff0000) ) { | ||
4721 | 988 | rmask = 0xff; | ||
4722 | 989 | bmask = 0xff0000; | ||
4723 | 990 | } else if ( vf->Rmask == 0xFF00 && (vf->Bmask == 0xFF000000) ) { | ||
4724 | 991 | amask = 0x000000FF; | ||
4725 | 992 | rmask = 0x0000FF00; | ||
4726 | 993 | gmask = 0x00FF0000; | ||
4727 | 994 | bmask = 0xFF000000; | ||
4728 | 995 | } | ||
4729 | 996 | break; | ||
4730 | 997 | |||
4731 | 998 | default: | ||
4732 | 999 | /* We have no other optimised formats right now. When/if a new | ||
4733 | 1000 | optimised alpha format is written, add the converter here */ | ||
4734 | 1001 | break; | ||
4735 | 1002 | } | ||
4736 | 1003 | format = SDL_AllocFormat(32, rmask, gmask, bmask, amask); | ||
4737 | 1004 | flags = SDL_PublicSurface->flags & SDL_HWSURFACE; | ||
4738 | 1005 | flags |= surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK); | ||
4739 | 1006 | converted = SDL_ConvertSurface(surface, format, flags); | ||
4740 | 1007 | SDL_FreeFormat(format); | ||
4741 | 1008 | return(converted); | ||
4742 | 1009 | } | ||
4743 | 1010 | |||
4744 | 1011 | /* | ||
4745 | 1012 | * Update a specific portion of the physical screen | ||
4746 | 1013 | */ | ||
4747 | 1014 | void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) | ||
4748 | 1015 | { | ||
4749 | 1016 | if ( screen ) { | ||
4750 | 1017 | SDL_Rect rect; | ||
4751 | 1018 | |||
4752 | 1019 | /* Perform some checking */ | ||
4753 | 1020 | if ( w == 0 ) | ||
4754 | 1021 | w = screen->w; | ||
4755 | 1022 | if ( h == 0 ) | ||
4756 | 1023 | h = screen->h; | ||
4757 | 1024 | if ( (int)(x+w) > screen->w ) | ||
4758 | 1025 | return; | ||
4759 | 1026 | if ( (int)(y+h) > screen->h ) | ||
4760 | 1027 | return; | ||
4761 | 1028 | |||
4762 | 1029 | /* Fill the rectangle */ | ||
4763 | 1030 | rect.x = (Sint16)x; | ||
4764 | 1031 | rect.y = (Sint16)y; | ||
4765 | 1032 | rect.w = (Uint16)w; | ||
4766 | 1033 | rect.h = (Uint16)h; | ||
4767 | 1034 | SDL_UpdateRects(screen, 1, &rect); | ||
4768 | 1035 | } | ||
4769 | 1036 | } | ||
4770 | 1037 | void SDL_UpdateRects (SDL_Surface *screen, int numrects, SDL_Rect *rects) | ||
4771 | 1038 | { | ||
4772 | 1039 | int i; | ||
4773 | 1040 | SDL_VideoDevice *video = current_video; | ||
4774 | 1041 | SDL_VideoDevice *this = current_video; | ||
4775 | 1042 | |||
4776 | 1043 | if ( (screen->flags & (SDL_OPENGL | SDL_OPENGLBLIT)) == SDL_OPENGL ) { | ||
4777 | 1044 | SDL_SetError("OpenGL active, use SDL_GL_SwapBuffers()"); | ||
4778 | 1045 | return; | ||
4779 | 1046 | } | ||
4780 | 1047 | if ( screen == SDL_ShadowSurface ) { | ||
4781 | 1048 | /* Blit the shadow surface using saved mapping */ | ||
4782 | 1049 | SDL_Palette *pal = screen->format->palette; | ||
4783 | 1050 | SDL_Color *saved_colors = NULL; | ||
4784 | 1051 | if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) { | ||
4785 | 1052 | /* simulated 8bpp, use correct physical palette */ | ||
4786 | 1053 | saved_colors = pal->colors; | ||
4787 | 1054 | if ( video->gammacols ) { | ||
4788 | 1055 | /* gamma-corrected palette */ | ||
4789 | 1056 | pal->colors = video->gammacols; | ||
4790 | 1057 | } else if ( video->physpal ) { | ||
4791 | 1058 | /* physical palette different from logical */ | ||
4792 | 1059 | pal->colors = video->physpal->colors; | ||
4793 | 1060 | } | ||
4794 | 1061 | } | ||
4795 | 1062 | if ( SHOULD_DRAWCURSOR(SDL_cursorstate) ) { | ||
4796 | 1063 | SDL_LockCursor(); | ||
4797 | 1064 | SDL_DrawCursor(SDL_ShadowSurface); | ||
4798 | 1065 | for ( i=0; i<numrects; ++i ) { | ||
4799 | 1066 | SDL_LowerBlit(SDL_ShadowSurface, &rects[i], | ||
4800 | 1067 | SDL_VideoSurface, &rects[i]); | ||
4801 | 1068 | } | ||
4802 | 1069 | SDL_EraseCursor(SDL_ShadowSurface); | ||
4803 | 1070 | SDL_UnlockCursor(); | ||
4804 | 1071 | } else { | ||
4805 | 1072 | for ( i=0; i<numrects; ++i ) { | ||
4806 | 1073 | SDL_LowerBlit(SDL_ShadowSurface, &rects[i], | ||
4807 | 1074 | SDL_VideoSurface, &rects[i]); | ||
4808 | 1075 | } | ||
4809 | 1076 | } | ||
4810 | 1077 | if ( saved_colors ) { | ||
4811 | 1078 | pal->colors = saved_colors; | ||
4812 | 1079 | } | ||
4813 | 1080 | |||
4814 | 1081 | /* Fall through to video surface update */ | ||
4815 | 1082 | screen = SDL_VideoSurface; | ||
4816 | 1083 | } | ||
4817 | 1084 | if ( screen == SDL_VideoSurface ) { | ||
4818 | 1085 | /* Update the video surface */ | ||
4819 | 1086 | if ( screen->offset ) { | ||
4820 | 1087 | for ( i=0; i<numrects; ++i ) { | ||
4821 | 1088 | rects[i].x += video->offset_x; | ||
4822 | 1089 | rects[i].y += video->offset_y; | ||
4823 | 1090 | } | ||
4824 | 1091 | video->UpdateRects(this, numrects, rects); | ||
4825 | 1092 | for ( i=0; i<numrects; ++i ) { | ||
4826 | 1093 | rects[i].x -= video->offset_x; | ||
4827 | 1094 | rects[i].y -= video->offset_y; | ||
4828 | 1095 | } | ||
4829 | 1096 | } else { | ||
4830 | 1097 | video->UpdateRects(this, numrects, rects); | ||
4831 | 1098 | } | ||
4832 | 1099 | } | ||
4833 | 1100 | } | ||
4834 | 1101 | |||
4835 | 1102 | /* | ||
4836 | 1103 | * Performs hardware double buffering, if possible, or a full update if not. | ||
4837 | 1104 | */ | ||
4838 | 1105 | int SDL_Flip(SDL_Surface *screen) | ||
4839 | 1106 | { | ||
4840 | 1107 | SDL_VideoDevice *video = current_video; | ||
4841 | 1108 | /* Copy the shadow surface to the video surface */ | ||
4842 | 1109 | if ( screen == SDL_ShadowSurface ) { | ||
4843 | 1110 | SDL_Rect rect; | ||
4844 | 1111 | SDL_Palette *pal = screen->format->palette; | ||
4845 | 1112 | SDL_Color *saved_colors = NULL; | ||
4846 | 1113 | if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) { | ||
4847 | 1114 | /* simulated 8bpp, use correct physical palette */ | ||
4848 | 1115 | saved_colors = pal->colors; | ||
4849 | 1116 | if ( video->gammacols ) { | ||
4850 | 1117 | /* gamma-corrected palette */ | ||
4851 | 1118 | pal->colors = video->gammacols; | ||
4852 | 1119 | } else if ( video->physpal ) { | ||
4853 | 1120 | /* physical palette different from logical */ | ||
4854 | 1121 | pal->colors = video->physpal->colors; | ||
4855 | 1122 | } | ||
4856 | 1123 | } | ||
4857 | 1124 | |||
4858 | 1125 | rect.x = 0; | ||
4859 | 1126 | rect.y = 0; | ||
4860 | 1127 | rect.w = screen->w; | ||
4861 | 1128 | rect.h = screen->h; | ||
4862 | 1129 | if ( SHOULD_DRAWCURSOR(SDL_cursorstate) ) { | ||
4863 | 1130 | SDL_LockCursor(); | ||
4864 | 1131 | SDL_DrawCursor(SDL_ShadowSurface); | ||
4865 | 1132 | SDL_LowerBlit(SDL_ShadowSurface, &rect, | ||
4866 | 1133 | SDL_VideoSurface, &rect); | ||
4867 | 1134 | SDL_EraseCursor(SDL_ShadowSurface); | ||
4868 | 1135 | SDL_UnlockCursor(); | ||
4869 | 1136 | } else { | ||
4870 | 1137 | SDL_LowerBlit(SDL_ShadowSurface, &rect, | ||
4871 | 1138 | SDL_VideoSurface, &rect); | ||
4872 | 1139 | } | ||
4873 | 1140 | if ( saved_colors ) { | ||
4874 | 1141 | pal->colors = saved_colors; | ||
4875 | 1142 | } | ||
4876 | 1143 | |||
4877 | 1144 | /* Fall through to video surface update */ | ||
4878 | 1145 | screen = SDL_VideoSurface; | ||
4879 | 1146 | } | ||
4880 | 1147 | if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) { | ||
4881 | 1148 | SDL_VideoDevice *this = current_video; | ||
4882 | 1149 | return(video->FlipHWSurface(this, SDL_VideoSurface)); | ||
4883 | 1150 | } else { | ||
4884 | 1151 | SDL_UpdateRect(screen, 0, 0, 0, 0); | ||
4885 | 1152 | } | ||
4886 | 1153 | return(0); | ||
4887 | 1154 | } | ||
4888 | 1155 | |||
4889 | 1156 | static void SetPalette_logical(SDL_Surface *screen, SDL_Color *colors, | ||
4890 | 1157 | int firstcolor, int ncolors) | ||
4891 | 1158 | { | ||
4892 | 1159 | SDL_Palette *pal = screen->format->palette; | ||
4893 | 1160 | SDL_Palette *vidpal; | ||
4894 | 1161 | |||
4895 | 1162 | if ( colors != (pal->colors + firstcolor) ) { | ||
4896 | 1163 | SDL_memcpy(pal->colors + firstcolor, colors, | ||
4897 | 1164 | ncolors * sizeof(*colors)); | ||
4898 | 1165 | } | ||
4899 | 1166 | |||
4900 | 1167 | if ( current_video && SDL_VideoSurface ) { | ||
4901 | 1168 | vidpal = SDL_VideoSurface->format->palette; | ||
4902 | 1169 | if ( (screen == SDL_ShadowSurface) && vidpal ) { | ||
4903 | 1170 | /* | ||
4904 | 1171 | * This is a shadow surface, and the physical | ||
4905 | 1172 | * framebuffer is also indexed. Propagate the | ||
4906 | 1173 | * changes to its logical palette so that | ||
4907 | 1174 | * updates are always identity blits | ||
4908 | 1175 | */ | ||
4909 | 1176 | SDL_memcpy(vidpal->colors + firstcolor, colors, | ||
4910 | 1177 | ncolors * sizeof(*colors)); | ||
4911 | 1178 | } | ||
4912 | 1179 | } | ||
4913 | 1180 | SDL_FormatChanged(screen); | ||
4914 | 1181 | } | ||
4915 | 1182 | |||
4916 | 1183 | static int SetPalette_physical(SDL_Surface *screen, | ||
4917 | 1184 | SDL_Color *colors, int firstcolor, int ncolors) | ||
4918 | 1185 | { | ||
4919 | 1186 | SDL_VideoDevice *video = current_video; | ||
4920 | 1187 | int gotall = 1; | ||
4921 | 1188 | |||
4922 | 1189 | if ( video->physpal ) { | ||
4923 | 1190 | /* We need to copy the new colors, since we haven't | ||
4924 | 1191 | * already done the copy in the logical set above. | ||
4925 | 1192 | */ | ||
4926 | 1193 | SDL_memcpy(video->physpal->colors + firstcolor, | ||
4927 | 1194 | colors, ncolors * sizeof(*colors)); | ||
4928 | 1195 | } | ||
4929 | 1196 | if ( screen == SDL_ShadowSurface ) { | ||
4930 | 1197 | if ( SDL_VideoSurface->flags & SDL_HWPALETTE ) { | ||
4931 | 1198 | /* | ||
4932 | 1199 | * The real screen is also indexed - set its physical | ||
4933 | 1200 | * palette. The physical palette does not include the | ||
4934 | 1201 | * gamma modification, we apply it directly instead, | ||
4935 | 1202 | * but this only happens if we have hardware palette. | ||
4936 | 1203 | */ | ||
4937 | 1204 | screen = SDL_VideoSurface; | ||
4938 | 1205 | } else { | ||
4939 | 1206 | /* | ||
4940 | 1207 | * The video surface is not indexed - invalidate any | ||
4941 | 1208 | * active shadow-to-video blit mappings. | ||
4942 | 1209 | */ | ||
4943 | 1210 | if ( screen->map->dst == SDL_VideoSurface ) { | ||
4944 | 1211 | SDL_InvalidateMap(screen->map); | ||
4945 | 1212 | } | ||
4946 | 1213 | if ( video->gamma ) { | ||
4947 | 1214 | if( ! video->gammacols ) { | ||
4948 | 1215 | SDL_Palette *pp = video->physpal; | ||
4949 | 1216 | if(!pp) | ||
4950 | 1217 | pp = screen->format->palette; | ||
4951 | 1218 | video->gammacols = SDL_malloc(pp->ncolors | ||
4952 | 1219 | * sizeof(SDL_Color)); | ||
4953 | 1220 | SDL_ApplyGamma(video->gamma, | ||
4954 | 1221 | pp->colors, | ||
4955 | 1222 | video->gammacols, | ||
4956 | 1223 | pp->ncolors); | ||
4957 | 1224 | } else { | ||
4958 | 1225 | SDL_ApplyGamma(video->gamma, colors, | ||
4959 | 1226 | video->gammacols | ||
4960 | 1227 | + firstcolor, | ||
4961 | 1228 | ncolors); | ||
4962 | 1229 | } | ||
4963 | 1230 | } | ||
4964 | 1231 | SDL_UpdateRect(screen, 0, 0, 0, 0); | ||
4965 | 1232 | } | ||
4966 | 1233 | } | ||
4967 | 1234 | |||
4968 | 1235 | if ( screen == SDL_VideoSurface ) { | ||
4969 | 1236 | SDL_Color gcolors[256]; | ||
4970 | 1237 | |||
4971 | 1238 | if ( video->gamma ) { | ||
4972 | 1239 | SDL_ApplyGamma(video->gamma, colors, gcolors, ncolors); | ||
4973 | 1240 | colors = gcolors; | ||
4974 | 1241 | } | ||
4975 | 1242 | gotall = video->SetColors(video, firstcolor, ncolors, colors); | ||
4976 | 1243 | if ( ! gotall ) { | ||
4977 | 1244 | /* The video flags shouldn't have SDL_HWPALETTE, and | ||
4978 | 1245 | the video driver is responsible for copying back the | ||
4979 | 1246 | correct colors into the video surface palette. | ||
4980 | 1247 | */ | ||
4981 | 1248 | ; | ||
4982 | 1249 | } | ||
4983 | 1250 | SDL_CursorPaletteChanged(); | ||
4984 | 1251 | } | ||
4985 | 1252 | return gotall; | ||
4986 | 1253 | } | ||
4987 | 1254 | |||
4988 | 1255 | /* | ||
4989 | 1256 | * Set the physical and/or logical colormap of a surface: | ||
4990 | 1257 | * Only the screen has a physical colormap. It determines what is actually | ||
4991 | 1258 | * sent to the display. | ||
4992 | 1259 | * The logical colormap is used to map blits to/from the surface. | ||
4993 | 1260 | * 'which' is one or both of SDL_LOGPAL, SDL_PHYSPAL | ||
4994 | 1261 | * | ||
4995 | 1262 | * Return nonzero if all colours were set as requested, or 0 otherwise. | ||
4996 | 1263 | */ | ||
4997 | 1264 | int SDL_SetPalette(SDL_Surface *screen, int which, | ||
4998 | 1265 | SDL_Color *colors, int firstcolor, int ncolors) | ||
4999 | 1266 | { | ||
5000 | 1267 | SDL_Palette *pal; |
The diff is a lot larger then the actual patch... since the patch touches (lightly) on a few large files. They get include in the .pc/mir-support/ files. The main patch is around ~1.7k