File: main.c

package info (click to toggle)
cmake 4.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 152,344 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (34 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <assert.h>
#include <gif_lib.h>
#include <stdio.h>
#include <string.h>

// GIFLIB before version 5 didn't know this macro
#ifndef GIFLIB_MAJOR
#  define GIFLIB_MAJOR 4
#endif

int main(void)
{
  // because of the API changes we have to test different functions depending
  // on the version of GIFLIB
#if GIFLIB_MAJOR >= 5
  // test the linker
  GifErrorString(D_GIF_SUCCEEDED);

  // check the version
  char gif_version_string[16];
  snprintf(gif_version_string, 16, "%i.%i.%i", GIFLIB_MAJOR, GIFLIB_MINOR,
           GIFLIB_RELEASE);

  assert(strcmp(gif_version_string, CMAKE_EXPECTED_GIF_VERSION) == 0);
#else
  // test the linker
  GifLastError();

  // unfortunately there is no way to check the version in older version of
  // GIFLIB
#endif

  return 0;
}