19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Test program to compare the compile-time version of SDL with the linked
39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall   version of SDL
49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/
59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <stdio.h>
79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <stdlib.h>
89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL.h"
109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint main(int argc, char *argv[])
129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{
139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_version compiled;
149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	/* Initialize SDL */
169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	if ( SDL_Init(0) < 0 ) {
179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		exit(1);
199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	}
209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef DEBUG
219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	fprintf(stderr, "SDL initialized\n");
229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif
239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if SDL_VERSION_ATLEAST(1, 2, 0)
249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	printf("Compiled with SDL 1.2 or newer\n");
259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#else
269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	printf("Compiled with SDL older than 1.2\n");
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_VERSION(&compiled);
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	printf("Compiled version: %d.%d.%d\n",
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			compiled.major, compiled.minor, compiled.patch);
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	printf("Linked version: %d.%d.%d\n",
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			SDL_Linked_Version()->major,
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			SDL_Linked_Version()->minor,
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall			SDL_Linked_Version()->patch);
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	SDL_Quit();
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	return(0);
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}
38