test/testver.c
author Ryan C. Gordon <icculus@icculus.org>
Thu, 19 Feb 2015 23:52:10 -0500
changeset 9370 795d4866e4db
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
permissions -rw-r--r--
Mac OS X: Better way to stop duplicate joystick reports (thanks, Kyungdahm!).

Fixes Bugzilla #2822.
     1 /*
     2   Copyright (C) 1997-2014 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 	/* Enable standard application logging */
    30     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    31 
    32 #if SDL_VERSION_ATLEAST(2, 0, 0)
    33     SDL_Log("Compiled with SDL 2.0 or newer\n");
    34 #else
    35     SDL_Log("Compiled with SDL older than 2.0\n");
    36 #endif
    37     SDL_VERSION(&compiled);
    38     SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
    39            compiled.major, compiled.minor, compiled.patch,
    40            SDL_REVISION_NUMBER, SDL_REVISION);
    41     SDL_GetVersion(&linked);
    42     SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
    43            linked.major, linked.minor, linked.patch,
    44            SDL_GetRevisionNumber(), SDL_GetRevision());
    45     SDL_Quit();
    46     return (0);
    47 }