2006-07-29 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / jnlib / types.h
blob89d2459437757de207f6ee06172668b22307fe82
1 /* types.h
2 * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GnuPG 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 General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * 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.
22 #ifndef LIBJNLIB_TYPES_H
23 #define LIBJNLIB_TYPES_H
25 /* The AC_CHECK_SIZEOF() in configure fails for some machines.
26 * we provide some fallback values here */
27 #if !SIZEOF_UNSIGNED_SHORT
28 #undef SIZEOF_UNSIGNED_SHORT
29 #define SIZEOF_UNSIGNED_SHORT 2
30 #endif
31 #if !SIZEOF_UNSIGNED_INT
32 #undef SIZEOF_UNSIGNED_INT
33 #define SIZEOF_UNSIGNED_INT 4
34 #endif
35 #if !SIZEOF_UNSIGNED_LONG
36 #undef SIZEOF_UNSIGNED_LONG
37 #define SIZEOF_UNSIGNED_LONG 4
38 #endif
41 #include <sys/types.h>
44 #ifndef HAVE_BYTE_TYPEDEF
45 #undef byte /* maybe there is a macro with this name */
46 /* Windows typedefs byte in the rpc headers. Avoid warning about
47 double definition. */
48 #if !(defined(_WIN32) && defined(cbNDRContext))
49 typedef unsigned char byte;
50 #endif
51 #define HAVE_BYTE_TYPEDEF
52 #endif
54 #ifndef HAVE_USHORT_TYPEDEF
55 #undef ushort /* maybe there is a macro with this name */
56 typedef unsigned short ushort;
57 #define HAVE_USHORT_TYPEDEF
58 #endif
60 #ifndef HAVE_ULONG_TYPEDEF
61 #undef ulong /* maybe there is a macro with this name */
62 typedef unsigned long ulong;
63 #define HAVE_ULONG_TYPEDEF
64 #endif
66 #ifndef HAVE_U16_TYPEDEF
67 #undef u16 /* maybe there is a macro with this name */
68 #if SIZEOF_UNSIGNED_INT == 2
69 typedef unsigned int u16;
70 #elif SIZEOF_UNSIGNED_SHORT == 2
71 typedef unsigned short u16;
72 #else
73 #error no typedef for u16
74 #endif
75 #define HAVE_U16_TYPEDEF
76 #endif
78 #ifndef HAVE_U32_TYPEDEF
79 #undef u32 /* maybe there is a macro with this name */
80 #if SIZEOF_UNSIGNED_INT == 4
81 typedef unsigned int u32;
82 #elif SIZEOF_UNSIGNED_LONG == 4
83 typedef unsigned long u32;
84 #else
85 #error no typedef for u32
86 #endif
87 #define HAVE_U32_TYPEDEF
88 #endif
90 #ifndef HAVE_U64_TYPEDEF
91 #undef u64 /* maybe there is a macro with this name */
92 #if SIZEOF_UNSIGNED_INT == 8
93 typedef unsigned int u64;
94 #define HAVE_U64_TYPEDEF
95 #elif SIZEOF_UNSIGNED_LONG == 8
96 typedef unsigned long u64;
97 #define HAVE_U64_TYPEDEF
98 #elif __GNUC__ >= 2 || defined(__SUNPRO_C)
99 typedef unsigned long long u64;
100 #define HAVE_U64_TYPEDEF
101 #endif
102 #endif
106 #endif /*LIBJNLIB_TYPES_H*/