1 /************************************************************************** 2 * kvu_inttypes.h: Ensure that C99 guaranteed length integer types are 3 * defined in the current environment 4 * Copyright (C) 2003 Kai Vehmanen 5 * 6 * This program 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. 10 * 11 * This program 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. 15 * 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 19 **************************************************************************/ 20 21 #ifndef INCLUDED_KVU_INTTYPES_H 22 #define INCLUDED_KVU_INTTYPES_H 23 24 #ifdef HAVE_CONFIG_H 25 #include <config.h> 26 #endif 27 28 /* 1. stdint.h: the C99 standard */ 29 #ifdef HAVE_STDINT_H 30 #include <stdint.h> 31 #else 32 33 /* 2.1 inttypes.h: C99 and Single Unix Specification v2 */ 34 #if HAVE_INTTYPES_H 35 #include <inttypes.h> 36 37 /* 2.2 sys/types.h: POSIX */ 38 #elif HAVE_SYS_TYPES_H 39 #include <sys/types.h> 40 /* Cygwin32 doesn't define all types */ 41 #ifdef __CYGWIN__ 42 typedef u_int8_t uint8_t; 43 typedef u_int16_t uint16_t; 44 typedef u_int32_t uint32_t; 45 #endif 46 47 /* 2.3 fallback to x86 defaults */ 48 #else 49 typedef signed char int8_t; 50 typedef unsigned char uint8_t; 51 typedef signed short int int16_t; 52 typedef unsigned short int uint16_t; 53 typedef signed int int32_t; 54 typedef unsigned int uint32_t; 55 56 #endif /* 2.x */ 57 #endif /* 1.x */ 58 59 #endif /* INCLUDED_KVU_INTTYPES_H */ 60