upgrade SDL to version 2.0.8
[platform/upstream/SDL.git] / test / testver.c
1 /*
2   Copyright (C) 1997-2018 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 int
23 main(int argc, char *argv[])
24 {
25     SDL_version compiled;
26     SDL_version linked;
27
28     /* Enable standard application logging */
29     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
30
31 #if SDL_VERSION_ATLEAST(2, 0, 0)
32     SDL_Log("Compiled with SDL 2.0 or newer\n");
33 #else
34     SDL_Log("Compiled with SDL older than 2.0\n");
35 #endif
36     SDL_VERSION(&compiled);
37     SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
38            compiled.major, compiled.minor, compiled.patch,
39            SDL_REVISION_NUMBER, SDL_REVISION);
40     SDL_GetVersion(&linked);
41     SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
42            linked.major, linked.minor, linked.patch,
43            SDL_GetRevisionNumber(), SDL_GetRevision());
44     SDL_Quit();
45     return (0);
46 }
47