test/testver.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 04 Jan 2019 22:01:14 -0800
changeset 12503 806492103856
parent 11811 5d94cb6b24d3
permissions -rw-r--r--
Updated copyright for 2019
slouken@5535
     1
/*
slouken@12503
     2
  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
slouken@5535
     3
slouken@5535
     4
  This software is provided 'as-is', without any express or implied
slouken@5535
     5
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     6
  arising from the use of this software.
slouken@5535
     7
slouken@5535
     8
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
     9
  including commercial applications, and to alter it and redistribute it
slouken@5535
    10
  freely.
slouken@5535
    11
*/
slouken@0
    12
slouken@0
    13
/* Test program to compare the compile-time version of SDL with the linked
slouken@0
    14
   version of SDL
slouken@0
    15
*/
slouken@0
    16
slouken@0
    17
#include <stdio.h>
icculus@1154
    18
#include <stdlib.h>
slouken@0
    19
slouken@0
    20
#include "SDL.h"
slouken@5310
    21
#include "SDL_revision.h"
slouken@0
    22
slouken@1895
    23
int
slouken@1895
    24
main(int argc, char *argv[])
slouken@0
    25
{
slouken@1895
    26
    SDL_version compiled;
slouken@2983
    27
    SDL_version linked;
slouken@0
    28
philipp@9922
    29
    /* Enable standard application logging */
aschiffler@7639
    30
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
aschiffler@7639
    31
slouken@6251
    32
#if SDL_VERSION_ATLEAST(2, 0, 0)
aschiffler@7639
    33
    SDL_Log("Compiled with SDL 2.0 or newer\n");
slouken@0
    34
#else
aschiffler@7639
    35
    SDL_Log("Compiled with SDL older than 2.0\n");
slouken@0
    36
#endif
slouken@1895
    37
    SDL_VERSION(&compiled);
aschiffler@7639
    38
    SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
slouken@5359
    39
           compiled.major, compiled.minor, compiled.patch,
slouken@5359
    40
           SDL_REVISION_NUMBER, SDL_REVISION);
slouken@2983
    41
    SDL_GetVersion(&linked);
aschiffler@7639
    42
    SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
slouken@5359
    43
           linked.major, linked.minor, linked.patch,
slouken@5359
    44
           SDL_GetRevisionNumber(), SDL_GetRevision());
slouken@1895
    45
    SDL_Quit();
slouken@1895
    46
    return (0);
slouken@0
    47
}