diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2008-09-25 09:46:18 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2008-09-25 09:46:18 +0700 |
commit | 0cd14a8591c2ddb7fca5e576f6322a89097f5fc7 (patch) | |
tree | d8ca42f30812db5b6b6d558fc6f3441c0fe2971f | |
parent | d90637e2136fcd8878614d7e7a9abc0ef74c07c1 (diff) | |
download | libsha1-0cd14a8591c2ddb7fca5e576f6322a89097f5fc7.tar.gz |
uint_NNt types search replaced with autoconf check
-rw-r--r-- | brg_types.h | 85 | ||||
-rw-r--r-- | config.h.in | 34 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | sha1.h | 1 |
4 files changed, 48 insertions, 81 deletions
diff --git a/brg_types.h b/brg_types.h index 32aa9f7..4738359 100644 --- a/brg_types.h +++ b/brg_types.h @@ -45,85 +45,22 @@ #if defined(__cplusplus)
extern "C" {
#endif
-
-#include <limits.h>
-
-#ifndef BRG_UI8
-# define BRG_UI8
-# if UCHAR_MAX == 255u
- typedef unsigned char uint_8t;
-# else
-# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h
-# endif
-#endif
-
-#ifndef BRG_UI16
-# define BRG_UI16
-# if USHRT_MAX == 65535u
- typedef unsigned short uint_16t;
-# else
-# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h
-# endif
-#endif
-
-#ifndef BRG_UI32
-# define BRG_UI32
-# if UINT_MAX == 4294967295u
-# define li_32(h) 0x##h##u
- typedef unsigned int uint_32t;
-# elif ULONG_MAX == 4294967295u
-# define li_32(h) 0x##h##ul
- typedef unsigned long uint_32t;
-# elif defined( _CRAY )
-# error This code needs 32-bit data types, which Cray machines do not provide
-# else
-# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h
-# endif
+#if 0
+}
#endif
-#ifndef BRG_UI64
-# if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
-# define BRG_UI64
-# define li_64(h) 0x##h##ull
- typedef unsigned __int64 uint_64t;
-# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */
-# define BRG_UI64
-# define li_64(h) 0x##h##ui64
- typedef unsigned __int64 uint_64t;
-# elif defined( __sun ) && defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
-# define BRG_UI64
-# define li_64(h) 0x##h##ull
- typedef unsigned long long uint_64t;
-# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
-# if UINT_MAX == 18446744073709551615u
-# define BRG_UI64
-# define li_64(h) 0x##h##u
- typedef unsigned int uint_64t;
-# endif
-# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
-# if ULONG_MAX == 18446744073709551615ul
-# define BRG_UI64
-# define li_64(h) 0x##h##ul
- typedef unsigned long uint_64t;
-# endif
-# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
-# if ULLONG_MAX == 18446744073709551615ull
-# define BRG_UI64
-# define li_64(h) 0x##h##ull
- typedef unsigned long long uint_64t;
-# endif
-# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
-# if ULONG_LONG_MAX == 18446744073709551615ull
-# define BRG_UI64
-# define li_64(h) 0x##h##ull
- typedef unsigned long long uint_64t;
-# endif
-# endif
+#if defined(HAVE_CONFIG_H)
+# include "config.h"
#endif
-#if defined( NEED_UINT_64T ) && !defined( BRG_UI64 )
-# error Please define uint_64t as an unsigned 64 bit type in brg_types.h
+#if defined(HAVE_STDINT_H)
+# include <stdint.h>
#endif
+
+typedef uint8_t uint_8t;
+typedef uint16_t uint_16t;
+typedef uint32_t uint_32t;
+typedef uint64_t uint_64t;
#ifndef RETURN_VALUES
# define RETURN_VALUES
diff --git a/config.h.in b/config.h.in index aa9477e..c1a0c5c 100644 --- a/config.h.in +++ b/config.h.in @@ -6,9 +6,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -61,5 +58,36 @@ first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN +/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + /* Define to empty if `const' does not conform to ANSI C. */ #undef const + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t diff --git a/configure.ac b/configure.ac index 608c88c..3bde507 100644 --- a/configure.ac +++ b/configure.ac @@ -8,12 +8,15 @@ AC_CONFIG_HEADER([config.h]) AC_PROG_CC AC_PROG_LIBTOOL -AC_HEADER_STDC -AC_CHECK_HEADERS([limits.h stdlib.h string.h]) +AC_CHECK_HEADERS([stdint.h string.h]) AC_C_BIGENDIAN - AC_C_CONST +AC_TYPE_UINT8_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T + AC_CONFIG_FILES([Makefile]) AC_OUTPUT @@ -33,7 +33,6 @@ #ifndef _SHA1_H
#define _SHA1_H
-#include <stdlib.h>
#include "brg_types.h"
#define SHA1_BLOCK_SIZE 64
|