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.
slouken@0
     1
slouken@0
     2
/* Test program to compare the compile-time version of SDL with the linked
slouken@0
     3
   version of SDL
slouken@0
     4
*/
slouken@0
     5
slouken@0
     6
#include <stdio.h>
icculus@1154
     7
#include <stdlib.h>
slouken@0
     8
slouken@0
     9
#include "SDL.h"
slouken@5310
    10
#include "SDL_revision.h"
slouken@0
    11
slouken@1895
    12
int
slouken@1895
    13
main(int argc, char *argv[])
slouken@0
    14
{
slouken@1895
    15
    SDL_version compiled;
slouken@2983
    16
    SDL_version linked;
slouken@0
    17
slouken@2983
    18
#if SDL_VERSION_ATLEAST(1, 3, 0)
slouken@2983
    19
    printf("Compiled with SDL 1.3 or newer\n");
slouken@0
    20
#else
slouken@2983
    21
    printf("Compiled with SDL older than 1.3\n");
slouken@0
    22
#endif
slouken@1895
    23
    SDL_VERSION(&compiled);
slouken@5359
    24
    printf("Compiled version: %d.%d.%d.%d (%s)\n",
slouken@5359
    25
           compiled.major, compiled.minor, compiled.patch,
slouken@5359
    26
           SDL_REVISION_NUMBER, SDL_REVISION);
slouken@2983
    27
    SDL_GetVersion(&linked);
slouken@5359
    28
    printf("Linked version: %d.%d.%d.%d (%s)\n",
slouken@5359
    29
           linked.major, linked.minor, linked.patch,
slouken@5359
    30
           SDL_GetRevisionNumber(), SDL_GetRevision());
slouken@1895
    31
    SDL_Quit();
slouken@1895
    32
    return (0);
slouken@0
    33
}