Line data Source code
1 : /* version.c - This version test should be run first.
2 : Copyright (C) 2007 Free Software Foundation, Inc.
3 :
4 : This file is part of Libgcrypt.
5 :
6 : Libgcrypt is free software; you can redistribute it and/or modify
7 : it under the terms of the GNU Lesser General Public License as
8 : published by the Free Software Foundation; either version 2.1 of
9 : the License, or (at your option) any later version.
10 :
11 : Libgcrypt is distributed in the hope that it will be useful,
12 : but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : GNU Lesser General Public License for more details.
15 :
16 : You should have received a copy of the GNU Lesser General Public
17 : License along with this program; if not, write to the Free Software
18 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 : USA. */
20 :
21 : /* This test should be run first because due to a failing config.links
22 : script or bad configure parameters the just build libgcrypt may
23 : crash in case MPI function for specific CPU revisions have been
24 : enabled. Running this test first will print out information so to
25 : make it easier to figure out the problem. */
26 :
27 :
28 : #ifdef HAVE_CONFIG_H
29 : #include <config.h>
30 : #endif
31 : #include <stdio.h>
32 : #include <stdlib.h>
33 : #include <string.h>
34 : #include <stdarg.h>
35 :
36 : #include "../src/gcrypt-int.h"
37 :
38 : #define PGM "version"
39 :
40 :
41 : int
42 1 : main (int argc, char **argv)
43 : {
44 : (void)argc;
45 : (void)argv;
46 :
47 1 : gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
48 1 : if (strcmp (GCRYPT_VERSION, gcry_check_version (NULL)))
49 : {
50 0 : int oops = !gcry_check_version (GCRYPT_VERSION);
51 0 : fprintf (stderr, PGM ": %sversion mismatch; pgm=%s, library=%s\n",
52 : oops? "":"warning: ", GCRYPT_VERSION, gcry_check_version (NULL));
53 0 : if (oops)
54 0 : exit (1);
55 : }
56 :
57 1 : gcry_control (GCRYCTL_PRINT_CONFIG, NULL);
58 :
59 1 : return 0;
60 : }
|