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 : #include "t-common.h"
40 :
41 :
42 : int
43 1 : main (int argc, char **argv)
44 : {
45 : (void)argc;
46 : (void)argv;
47 :
48 1 : xgcry_control (GCRYCTL_DISABLE_SECMEM, 0);
49 1 : if (strcmp (GCRYPT_VERSION, gcry_check_version (NULL)))
50 : {
51 1 : int oops = !gcry_check_version (GCRYPT_VERSION);
52 1 : fprintf (stderr, PGM ": %sversion mismatch; pgm=%s, library=%s\n",
53 : oops? "":"warning: ", GCRYPT_VERSION, gcry_check_version (NULL));
54 1 : if (oops)
55 0 : exit (1);
56 : }
57 :
58 1 : xgcry_control (GCRYCTL_PRINT_CONFIG, NULL);
59 :
60 1 : return 0;
61 : }
|