Expand the correct "#include <stdint.h" into types.h.
authorjbj <devnull@localhost>
Mon, 12 May 2003 00:07:54 +0000 (00:07 +0000)
committerjbj <devnull@localhost>
Mon, 12 May 2003 00:07:54 +0000 (00:07 +0000)
Add typedef for whatever lock structure that is used.

CVS patchset: 6834
CVS date: 2003/05/12 00:07:54

beecrypt/configure.ac
beecrypt/types.h.in

index fb108a4..4e58cde 100644 (file)
@@ -356,19 +356,30 @@ if test "$ac_with_mtmalloc" = yes; then
 fi
 
 # Checks for libraries.
+# XXX Insert "typedef foo bc_lock_t" into types.h.
+typedef_bc_lock_t=
 if test "$ac_enable_threads" = yes; then
   if test "$ac_cv_header_thread_h" = yes; then
     AC_SEARCH_LIBS([mutex_lock],[thread],[
       AC_DEFINE([ENABLE_THREADS],1)
+      if test "$ac_cv_header_sync_h" = yes; then
+       typedef_bc_lock_t='typedef mutex_t bc_lock_t;'
+      else
+       typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;'
+      fi
       ])
   elif test "$ac_cv_header_pthread_h" = yes; then
     AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],[
       AC_DEFINE([ENABLE_THREADS],1)
+      if test "$ac_cv_header_pthread_h" = yes; then
+       typedef_bc_lock_t='typedef pthread_mutex_t bc_lock_t;'
+      fi
       ])
   else
     AC_MSG_WARN([Don't know which thread library to check for])
   fi
 fi
+AC_SUBST(typedef_bc_lock_t)
 
 if test "$ac_enable_aio" = yes; then
   BEECRYPT_WORKING_AIO
@@ -620,6 +631,26 @@ AC_TYPE_SIZE_T
 BEECRYPT_INT_TYPES
 BEECRYPT_CPU_BITS
 
+# XXX Insert correct stdint includes into types.h.
+include_stdint_h=
+if test "$ac_cv_header_stdint_h" = yes; then
+  include_stdint_h='#include <stdint.h>'
+elif test "$ac_cv_header_inttypes_h" = yes; then
+  include_stdint_h='#include <inttypes.h>'
+else
+  include_stdint_h='
+typedef signed char            int8_t;\
+typedef short int              int16_t;\
+typedef int                    int32_t;\
+typedef long long int          int64_t;\
+typedef unsigned char          uint8_t;\
+typedef unsigned short int     uint16_t;\
+typedef unsigned int           uint32_t;\
+typedef unsigned long long int uint64_t;\
+'
+fi
+AC_SUBST(include_stdint_h)
+
 if test "$ac_with_javaglue" = yes ; then
   CFLAGS="$CFLAGS -I$ac_cv_java_include"
   case $target_os in
index 0ae0004..05f53a0 100644 (file)
@@ -1,11 +1,5 @@
 /*
- * types.h
- *
- * Types.h generic system types file
- *
- * Copyright (c) 2000 Virtual Unlimited B.V.
- *
- * Author: Bob Deblier <bob@virtualunlimited.com>
+ * Copyright (c) 2000, 2003 Virtual Unlimited B.V.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  */
 
-#ifndef _BEECRYPT_TYPES_H
-#define _BEECRYPT_TYPES_H
+/*!\file types.h
+ * \brief BeeCrypt API, portability headers.
+ * \author Bob Deblier <bob.deblier@pandora.be>
+ */
+
+#ifndef _TYPES_H
+#define _TYPES_H
 
-#if WIN32 && !__CYGWIN32__
-# ifdef BEECRYPT_DLL_EXPORT
-#  define BEECRYPTAPI __declspec(dllexport)
-# else
-#  define BEECRYPTAPI __declspec(dllimport)
-# endif
-#else
 # define BEECRYPTAPI
-#endif
 
-#include <stdint.h>
+@include_stdint_h@
 
 /* Starting from GCC 3.2, the compiler seems smart enough to figure
  * out that we're trying to do a rotate without having to specify it.
@@ -104,4 +95,6 @@ typedef uint16_t mphw;
 # error
 #endif
 
-#endif /* _BEECRYPT_TYPES_H */
+@typedef_bc_lock_t@
+
+#endif /* _TYPES_H */