test/testver.c
author Sam Lantinga <slouken@libsdl.org>
Sun, 20 Feb 2011 10:42:51 -0800
changeset 5359 d5fe4ed3a28d
parent 5310 a9945ce48999
child 5535 96594ac5fd1a
permissions -rw-r--r--
Added a revision number for easy compile-time tests.
     1 
     2 /* Test program to compare the compile-time version of SDL with the linked
     3    version of SDL
     4 */
     5 
     6 #include <stdio.h>
     7 #include <stdlib.h>
     8 
     9 #include "SDL.h"
    10 #include "SDL_revision.h"
    11 
    12 int
    13 main(int argc, char *argv[])
    14 {
    15     SDL_version compiled;
    16     SDL_version linked;
    17 
    18 #if SDL_VERSION_ATLEAST(1, 3, 0)
    19     printf("Compiled with SDL 1.3 or newer\n");
    20 #else
    21     printf("Compiled with SDL older than 1.3\n");
    22 #endif
    23     SDL_VERSION(&compiled);
    24     printf("Compiled version: %d.%d.%d.%d (%s)\n",
    25            compiled.major, compiled.minor, compiled.patch,
    26            SDL_REVISION_NUMBER, SDL_REVISION);
    27     SDL_GetVersion(&linked);
    28     printf("Linked version: %d.%d.%d.%d (%s)\n",
    29            linked.major, linked.minor, linked.patch,
    30            SDL_GetRevisionNumber(), SDL_GetRevision());
    31     SDL_Quit();
    32     return (0);
    33 }