]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Add support for MSVC 2010 compiler (32bits)
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 12 Mar 2012 15:40:22 +0000 (15:40 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 12 Mar 2012 15:40:22 +0000 (15:40 +0000)
thirdparty/libtiff/CMakeLists.txt
thirdparty/libtiff/test_inline.c [new file with mode: 0644]
thirdparty/libtiff/tif_config.h.cmake.in

index 24332458b07a7dd16671ad9247483e364e75fe91..629637110353c26a6accf41252d15cc4e0fc65bf 100644 (file)
@@ -119,25 +119,6 @@ set(STRIP_SIZE_DEFAULT 8192)
 set(SUBIFD_SUPPORT 1)
 set(THUNDER_SUPPORT 1)
 
-if(HAVE_STDINT_H)
-  set(TIFF_INT8_T    int8_t)
-  set(TIFF_INT16_T   int16_t)
-  set(TIFF_INT32_T   int32_t)
-  set(TIFF_INT64_T   int64_t)
-  set(TIFF_UINT8_T   uint8_t)
-  set(TIFF_UINT16_T  uint16_t)
-  set(TIFF_UINT32_T  uint32_t)
-  set(TIFF_UINT64_T  uint64_t)
-  set(TIFF_PTRDIFF_T ptrdiff_t)
-  set(TIFF_SSIZE_T   ssize_t)
-  set(TIFF_INT32_FORMAT "\"%d\"")
-  set(TIFF_UINT32_FORMAT "\"%u\"")
-  set(TIFF_INT64_FORMAT "\"%ld\"")
-  set(TIFF_UINT64_FORMAT "\"%lu\"")
-  set(TIFF_PTRDIFF_FORMAT "\"%ld\"")
-  set(TIFF_SSIZE_FORMAT "\"%ld\"")
-endif()
-
 CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
 CHECK_FUNCTION_EXISTS(isascii HAVE_ISASCII)
 CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
@@ -162,6 +143,37 @@ CHECK_TYPE_SIZE("unsigned long"      SIZEOF_UNSIGNED_LONG)
 CHECK_TYPE_SIZE("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
 CHECK_TYPE_SIZE("unsigned short"     SIZEOF_UNSIGNED_SHORT)
 CHECK_TYPE_SIZE("unsigned char*"     SIZEOF_UNSIGNED_CHAR_P)
+# check platform has ssize_t:
+CHECK_TYPE_SIZE(ssize_t     SSIZE_T)
+
+if(HAVE_STDINT_H)
+  set(TIFF_INT8_T    int8_t)
+  set(TIFF_INT16_T   int16_t)
+  set(TIFF_INT32_T   int32_t)
+  set(TIFF_INT64_T   int64_t)
+  set(TIFF_UINT8_T   uint8_t)
+  set(TIFF_UINT16_T  uint16_t)
+  set(TIFF_UINT32_T  uint32_t)
+  set(TIFF_UINT64_T  uint64_t)
+  set(TIFF_PTRDIFF_T ptrdiff_t)
+  if(NOT HAVE_SSIZE_T)
+    if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+      set(TIFF_SSIZE_T   int64_t)
+    elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
+      set(TIFF_SSIZE_T   int32_t)
+    else()
+      message(FATAL_ERROR "unknown ssize_t")
+    endif()
+  else()
+    set(TIFF_SSIZE_T   ssize_t)
+  endif()
+  set(TIFF_INT32_FORMAT "\"%d\"")
+  set(TIFF_UINT32_FORMAT "\"%u\"")
+  set(TIFF_INT64_FORMAT "\"%ld\"")
+  set(TIFF_UINT64_FORMAT "\"%lu\"")
+  set(TIFF_PTRDIFF_FORMAT "\"%ld\"")
+  set(TIFF_SSIZE_FORMAT "\"%ld\"")
+endif()
 
 #
 set(VERSION "\"4.0.1\"")
@@ -178,6 +190,19 @@ CHECK_SYMBOL_EXISTS(pow "math.h" HAVE_POW)
 CHECK_SYMBOL_EXISTS(lfind "search.h" HAVE_LFIND)
 CHECK_SYMBOL_EXISTS(setmod "io.h" HAVE_SETMODE)
 
+# http://www.cmake.org/pipermail/cmake/2007-September/016285.html
+FOREACH(KEYWORD "inline" "__inline__" "__inline")
+  IF(NOT DEFINED C_INLINE)
+    TRY_COMPILE(C_HAS_${KEYWORD} "${CMAKE_CURRENT_BINARY_DIR}"
+       "${CMAKE_CURRENT_SOURCE_DIR}/test_inline.c"
+       COMPILE_DEFINITIONS "-Dinline=${KEYWORD}")
+    IF(C_HAS_${KEYWORD})
+      SET(C_INLINE TRUE)
+      SET(INLINE "${KEYWORD}")
+    ENDIF(C_HAS_${KEYWORD})
+  ENDIF(NOT DEFINED C_INLINE)
+ENDFOREACH(KEYWORD)
+
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffconf.h.cmake.in
   ${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h @ONLY)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmake.in
diff --git a/thirdparty/libtiff/test_inline.c b/thirdparty/libtiff/test_inline.c
new file mode 100644 (file)
index 0000000..ad25a9c
--- /dev/null
@@ -0,0 +1,10 @@
+/* Test source lifted from /usr/share/autoconf/autoconf/c.m4 */
+typedef int foo_t;
+static inline foo_t static_foo(){return 0;}
+foo_t foo(){return 0;}
+int main(int argc, char *argv[]){return 0;}
+/* Test source lifted from /usr/share/autoconf/autoconf/c.m4 */
+typedef int foo_t;
+static inline foo_t static_foo(){return 0;}
+foo_t foo(){return 0;}
+int main(int argc, char *argv[]){return 0;}
index d3711a76ee437bcbb7f6d014a4f5a3d0d4485f63..23bdc46a4ac90afb6fde45fbd61f669219ff3d53 100644 (file)
 /* Define to `__inline__' or `__inline' if that's what the C compiler
    calls it, or to nothing if 'inline' is not supported under any name.  */
 #ifndef __cplusplus
-#cmakedefine inline
+#define inline @INLINE@
 #endif
 
 /* Define to `long int' if <sys/types.h> does not define. */