test/testver.c
changeset 0 74212992fb08
child 850 c203b4a42701
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/testver.c	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,39 @@
     1.4 +
     1.5 +/* Test program to compare the compile-time version of SDL with the linked
     1.6 +   version of SDL
     1.7 +*/
     1.8 +
     1.9 +#include <stdio.h>
    1.10 +
    1.11 +#include "SDL.h"
    1.12 +#include "SDL_byteorder.h"
    1.13 +
    1.14 +int main(int argc, char *argv[])
    1.15 +{
    1.16 +	SDL_version compiled;
    1.17 +
    1.18 +	/* Initialize SDL */
    1.19 +	if ( SDL_Init(0) < 0 ) {
    1.20 +		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
    1.21 +		exit(1);
    1.22 +	}
    1.23 +#ifdef DEBUG
    1.24 +	fprintf(stderr, "SDL initialized\n");
    1.25 +#endif
    1.26 +#if SDL_VERSION_ATLEAST(1, 2, 0)
    1.27 +	printf("Compiled with SDL 1.2 or newer\n");
    1.28 +#else
    1.29 +	printf("Compiled with SDL older than 1.2\n");
    1.30 +#endif
    1.31 +	SDL_VERSION(&compiled);
    1.32 +	printf("Compiled version: %d.%d.%d\n",
    1.33 +			compiled.major, compiled.minor, compiled.patch);
    1.34 +	printf("Linked version: %d.%d.%d\n",
    1.35 +			SDL_Linked_Version()->major,
    1.36 +			SDL_Linked_Version()->minor,
    1.37 +			SDL_Linked_Version()->patch);
    1.38 +	printf("This is a %s endian machine.\n",
    1.39 +		(SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
    1.40 +	SDL_Quit();
    1.41 +	return(0);
    1.42 +}