option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
-if(NOT DEFINED SIZEOF_SIZE_T)
- if(IOS) # Workaround iOS issues
- set(SIZEOF_SIZE_T "${CMAKE_SIZEOF_VOID_P}")
- message(STATUS "SIZEOF_SIZE_T = ${SIZEOF_SIZE_T}")
- else()
- include(CheckTypeSize)
- CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
- endif()
+include(CheckCSourceCompiles)
+include(CheckIncludeFiles)
+include(CheckTypeSize)
+
+check_type_size("size_t" SIZEOF_SIZE_T)
+check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
+
+if(SIZEOF_SIZE_T EQUAL SIZEOF_UNSIGNED_LONG)
+ check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
+ HAVE_BUILTIN_CTZL)
+endif()
+if(MSVC)
+ check_include_files("intrin.h" HAVE_INTRIN_H)
endif()
+if(UNIX)
+ # Check for headers
+ check_include_files(locale.h HAVE_LOCALE_H)
+ check_include_files(stddef.h HAVE_STDDEF_H)
+ check_include_files(stdlib.h HAVE_STDLIB_H)
+ check_include_files(sys/types.h NEED_SYS_TYPES_H)
+
+ # Other predefines
+ # undef NEED_BSD_STRINGS
+ ocv_update(HAVE_UNSIGNED_CHAR 1)
+ ocv_update(HAVE_UNSIGNED_SHORT 1)
+ # undef INCOMPLETE_TYPES_BROKEN
+ ocv_update(RIGHT_SHIFT_IS_UNSIGNED 0)
+ ocv_update(__CHAR_UNSIGNED__ 0)
+endif()
+
+
set(BITS_IN_JSAMPLE 8)
if(WITH_ARITH_ENC)
add_definitions(-W3 -wd4996 -wd4018)
endif()
-configure_file(jconfig.h.in jconfig.h)
+if(WIN32)
+ configure_file(jconfig.h.win.in jconfig.h)
+else()
+ configure_file(jconfig.h.in jconfig.h)
+endif()
configure_file(jconfigint.h.in jconfigint.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
#undef inline
/* How to obtain function inlining. */
-#define INLINE @INLINE@
+#ifndef INLINE
+#if defined(__GNUC__)
+#define INLINE inline __attribute__((always_inline))
+#elif defined(_MSC_VER)
+#define INLINE __forceinline
+#else
+#define INLINE
+#endif
+#endif
/* Define to the full name of this package. */
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
#define VERSION "@VERSION@"
/* The size of `size_t', as computed by sizeof. */
-#define SIZEOF_SIZE_T @SIZE_T@
+#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
#cmakedefine HAVE_BUILTIN_CTZL