diff src/define.h @ 118:0f1492b7fe8b

patch from Fridrich Strba for building on mingw and general cleanup of autoconf files add processing for pst files of type 0x0f start adding support for properly building and installing libpst.so and the header files required to use it. remove version.h since the version number is now in config.h more const correctness issues regarding getopt()
author Carl Byington <carl@five-ten-sg.com>
date Sat, 31 Jan 2009 12:12:36 -0800
parents 987aa872294e
children 6395ced2b8b2
line wrap: on
line diff
--- a/src/define.h	Fri Jan 16 15:31:11 2009 -0800
+++ b/src/define.h	Sat Jan 31 12:12:36 2009 -0800
@@ -6,15 +6,14 @@
  */
 
 #ifdef HAVE_CONFIG_H
-    #include "config.h"
-#else
-    #ifdef _MSC_VER
-        #undef  HAVE_UNISTD_H
-        #define HAVE_DIRECT_H
-        #define HAVE_WINDOWS_H
-    #endif
+    #include <libpst/config.h>
 #endif
-#include "version.h"
+
+#ifdef _WIN32
+    #undef  HAVE_UNISTD_H
+    #define HAVE_DIRECT_H
+    #define HAVE_WINDOWS_H
+#endif
 
 #ifndef DEFINEH_H
 #define DEFINEH_H
@@ -59,40 +58,59 @@
 
 #define PERM_DIRS 0777
 
-#ifdef HAVE_UNISTD_H
-    #include <unistd.h>
-    #define D_MKDIR(x) mkdir(x, PERM_DIRS)
-#else
-    #include "XGetopt.h"
-    #ifdef HAVE_DIRECT_H
-        #include <direct.h>    // win32
-        #define D_MKDIR(x) mkdir(x)
-        #define chdir      _chdir
+#ifdef _WIN32
+    #include <direct.h>    // win32
+
+    #define D_MKDIR(x) mkdir(x)
+    #define chdir      _chdir
+
+    #define vsnprintf  _vsnprintf
+    #define snprintf   _snprintf
+    #ifdef _MSC_VER
+        #define ftello     _ftelli64
+        #define fseeko     _fseeki64
+    #elif defined (__MINGW32__)
+        #define ftello     ftello64
+        #define fseeko     fseeko64
+    #else
+        #error Only MSC and mingw supported for Windows
     #endif
+    #define strcasecmp _stricmp
+    #ifndef __MINGW32__
+        #define off_t      __int64
+        #define size_t     __int64
+    #endif
+    #define int64_t    __int64
+    #define uint64_t   unsigned __int64
+    #define int32_t    __int32
+    #define uint32_t   unsigned int
+    #define int16_t    short int
+    #define uint16_t   unsigned short int
+    #define int8_t     signed char
+    #define uint8_t    unsigned char
+    #ifndef UINT64_MAX
+        #define UINT64_MAX ((uint64_t)0xffffffffffffffff)
+    #endif
+    #define PRIx64 "I64x"
+    int __cdecl _fseeki64(FILE *, __int64, int);
+    __int64 __cdecl _ftelli64(FILE *);
 
-    #ifdef HAVE_WINDOWS_H
-        #include <windows.h>
+    #ifdef __MINGW32__
+        #include <getopt.h>
+    #else
+        #include "XGetopt.h"
     #endif
 
-    #ifdef _MSC_VER
-        #define vsnprintf  _vsnprintf
-        #define snprintf   _snprintf
-        #define ftello     _ftelli64
-        #define fseeko     _fseeki64
-        #define strcasecmp _stricmp
-        #define off_t      __int64
-        #define size_t     __int64
-        #define int64_t    __int64
-        #define uint64_t   unsigned __int64
-        #define int32_t    __int32
-        #define uint32_t   unsigned int
-        #define int16_t    short int
-        #define uint16_t   unsigned short int
-        #define int8_t     signed char
-        #define uint8_t    unsigned char
-        #define UINT64_MAX ((uint64_t)0xffffffffffffffff)
-        int __cdecl _fseeki64(FILE *, __int64, int);
-        __int64 __cdecl _ftelli64(FILE *);
+    #include <windows.h>
+#else
+    #ifdef HAVE_INTTYPES_H
+        #include <inttypes.h>
+    #endif
+    #ifdef HAVE_UNISTD_H
+        #include <unistd.h>
+        #define D_MKDIR(x) mkdir(x, PERM_DIRS)
+    #else
+        #include "XGetopt.h"
     #endif
 #endif