test/testver.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5359 d5fe4ed3a28d
child 6251 3e8c673cad58
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
     1 /*
     2   Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     3 
     4   This software is provided 'as-is', without any express or implied
     5   warranty.  In no event will the authors be held liable for any damages
     6   arising from the use of this software.
     7 
     8   Permission is granted to anyone to use this software for any purpose,
     9   including commercial applications, and to alter it and redistribute it
    10   freely.
    11 */
    12 
    13 /* Test program to compare the compile-time version of SDL with the linked
    14    version of SDL
    15 */
    16 
    17 #include <stdio.h>
    18 #include <stdlib.h>
    19 
    20 #include "SDL.h"
    21 #include "SDL_revision.h"
    22 
    23 int
    24 main(int argc, char *argv[])
    25 {
    26     SDL_version compiled;
    27     SDL_version linked;
    28 
    29 #if SDL_VERSION_ATLEAST(1, 3, 0)
    30     printf("Compiled with SDL 1.3 or newer\n");
    31 #else
    32     printf("Compiled with SDL older than 1.3\n");
    33 #endif
    34     SDL_VERSION(&compiled);
    35     printf("Compiled version: %d.%d.%d.%d (%s)\n",
    36            compiled.major, compiled.minor, compiled.patch,
    37            SDL_REVISION_NUMBER, SDL_REVISION);
    38     SDL_GetVersion(&linked);
    39     printf("Linked version: %d.%d.%d.%d (%s)\n",
    40            linked.major, linked.minor, linked.patch,
    41            SDL_GetRevisionNumber(), SDL_GetRevision());
    42     SDL_Quit();
    43     return (0);
    44 }