*** empty log message ***
[gnutls.git] / lib / defines.h
blobdd1d74b71aadb94b86518951b79dd98dcae97402
1 /*
2 * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos
4 * This file is part of GNUTLS.
6 * GNUTLS 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 * GNUTLS 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifndef DEFINES_H
22 # define DEFINES_H
24 #ifndef __GNUC__
25 # if HAVE_ALLOCA_H
26 # include <alloca.h>
27 # else
28 # ifdef _AIX
29 #pragma alloca
30 # else
31 # ifndef alloca /* predefined by HP cc +Olibcalls */
32 char *alloca();
33 # endif
34 # endif
35 # endif
36 #endif
39 #include <config.h>
41 #ifdef STDC_HEADERS
42 # include <string.h>
43 # include <stdlib.h>
44 # include <stdio.h>
45 # include <ctype.h>
46 #endif
48 #ifdef NO_TIME_T
49 typedef unsigned int time_t;
50 #endif
52 #ifdef NO_SIZE_T
53 typedef unsigned int size_t;
54 typedef int ssize_t;
55 #endif
57 #ifdef HAVE_STRINGS_H
58 # include <strings.h>
59 #endif
61 #ifdef HAVE_SYS_TYPES_H
62 # include <sys/types.h>
63 #endif
65 #ifdef HAVE_LIBGDBM
66 # include <gdbm.h>
67 #endif
69 #ifdef HAVE_SYS_STAT_H
70 # include <sys/stat.h>
71 #endif
73 #ifdef HAVE_UNISTD_H
74 # include <unistd.h>
75 #endif
77 #if TIME_WITH_SYS_TIME
78 # include <sys/time.h>
79 # include <time.h>
80 #else
81 # if HAVE_SYS_TIME_H
82 # include <sys/time.h>
83 # else
84 # include <time.h>
85 # endif
86 #endif
88 #ifdef HAVE_SYS_SOCKET_H
89 # include <sys/socket.h>
90 #endif
92 #ifdef LIBMCRYPT24
93 # define USE_MCRYPT
94 #endif
96 #if SIZEOF_UNSIGNED_LONG_INT == 8
97 # define HAVE_UINT64
98 /* only used native uint64 in 64 bit machines */
99 typedef unsigned long int uint64;
100 #else
101 /* some systems had problems with long long int, thus,
102 * it is not used.
104 typedef struct {
105 unsigned char i[8];
106 } uint64;
107 #endif
110 #if SIZEOF_UNSIGNED_LONG_INT == 4
111 typedef unsigned long int uint32;
112 typedef signed long int sint32;
113 #elif SIZEOF_UNSIGNED_INT == 4
114 typedef unsigned int uint32;
115 typedef signed int sint32;
116 #else
117 # error "Cannot find a 32 bit integer in your system, sorry."
118 #endif
120 #if SIZEOF_UNSIGNED_INT == 2
121 typedef unsigned int uint16;
122 typedef signed int sint16;
123 #elif SIZEOF_UNSIGNED_SHORT_INT == 2
124 typedef unsigned short int uint16;
125 typedef signed short int sint16;
126 #else
127 # error "Cannot find a 16 bit integer in your system, sorry."
128 #endif
130 #if SIZEOF_UNSIGNED_CHAR == 1
131 typedef unsigned char uint8;
132 typedef signed char int8;
133 #else
134 # error "Cannot find an 8 bit char in your system, sorry."
135 #endif
137 #ifndef HAVE_MEMMOVE
138 # ifdef HAVE_BCOPY
139 # define memmove(d, s, n) bcopy ((s), (d), (n))
140 # else
141 # error "Neither memmove nor bcopy exists on your system."
142 # endif
143 #endif
145 #endif /* defines_h */