Protect config.h #include.
[libtasn1.git] / lib / defines.h
blobd36a6756f7d9c33007a30c7d2866b0160a8cbee3
1 /*
2 * Copyright (C) 2000,2001,2002,2005 Nikos Mavroyanopoulos
4 * This file is part of LIBASN1.
6 * LIBASN1 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 * LIBASN1 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 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
28 #ifdef STDC_HEADERS
29 # include <string.h>
30 # include <stdlib.h>
31 # include <stdio.h>
32 # include <ctype.h>
33 #endif
35 #ifdef HAVE_STRINGS_H
36 # include <strings.h>
37 #endif
39 #ifdef HAVE_SYS_TYPES_H
40 # include <sys/types.h>
41 #endif
44 #if HAVE_INTTYPES_H
45 # include <inttypes.h>
46 #else
47 # if HAVE_STDINT_H
48 # include <stdint.h>
49 # else
50 #if SIZEOF_UNSIGNED_LONG_INT == 4
51 typedef unsigned long int uint32;
52 typedef signed long int sint32;
53 #elif SIZEOF_UNSIGNED_INT == 4
54 typedef unsigned int uint32;
55 typedef signed int sint32;
56 #else
57 # error "Cannot find a 32 bit integer in your system, sorry."
58 #endif
60 #if SIZEOF_UNSIGNED_INT == 2
61 typedef unsigned int uint16;
62 typedef signed int sint16;
63 #elif SIZEOF_UNSIGNED_SHORT_INT == 2
64 typedef unsigned short int uint16;
65 typedef signed short int sint16;
66 #else
67 # error "Cannot find a 16 bit integer in your system, sorry."
68 #endif
70 #if SIZEOF_UNSIGNED_CHAR == 1
71 typedef unsigned char uint8;
72 typedef signed char int8;
73 #else
74 # error "Cannot find an 8 bit char in your system, sorry."
75 #endif
77 #ifndef HAVE_MEMMOVE
78 # ifdef HAVE_BCOPY
79 # define memmove(d, s, n) bcopy ((s), (d), (n))
80 # else
81 # error "Neither memmove nor bcopy exists on your system."
82 # endif
83 #endif
84 # endif
85 #endif
87 #endif /* defines_h */