<commit_before>#need to find a few default headers:
INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(direct.h HAVE_DIRECT_H)          # src/streamindexer/filelister.cpp
CHECK_INCLUDE_FILE_CXX(dirent.h HAVE_DIRENT_H)          # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(dlfcn.h HAVE_DLFCN_H)            # src/streamindexer/analyzerloader.cpp/.h - do we really need it in .h?
CHECK_INCLUDE_FILE_CXX(ndir.h HAVE_NDIR_H)              # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(stddef.h HAVE_STDDEF_H)          # unused !
CHECK_INCLUDE_FILE_CXX(sys/dir.h HAVE_SYS_DIR_H)        # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(sys/ndir.h HAVE_SYS_NDIR_H)      # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)        # src/streamindexer/filelister.cpp

# files that may define the u?int{8,16,32,54}_t types
CHECK_INCLUDE_FILE_CXX(socket.h HAVE_SOCKET_H)
CHECK_INCLUDE_FILE_CXX(sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILE_CXX(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE_CXX(unistd.h HAVE_UNISTD_H)          # src/streamindexer/pluginendanalyzer.cpp
CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H)          # config.h, jstreamsconfig.h

#test for some functions that are missing on a particular system
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(fchdir HAVE_FCHDIR)               # unused !
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)   # src/luceneindexer/cluceneindexmanager.cpp, src/luceneindexer/cluceneindexreader.cpp, src/streams/compat/timeofday.h
CHECK_FUNCTION_EXISTS(isblank HAVE_ISBLANK)             # src/streams/mailinputstream.cpp, src/streams/compat/compat.cpp
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)         # src/storage/sqlitestorage.cpp, src/daemon/indexscheduler.cpp, src/searchclient/cmdlinestrigi.cpp
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)       # src/streamindexer/expatsaxendanalyzer.cpp, src/streamindexer/saxendanalyzer.cpp
CHECK_FUNCTION_EXISTS(strcasestr HAVE_STRCASESTR)       # src/streams/mailinputstream.cpp
CHECK_FUNCTION_EXISTS(strlwr HAVE_STRLWR)               # src/streamindexer/ifilterendanalyzer.cpp
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)     # src/streams/mailinputstream.cpp

#test for missing types
INCLUDE(CheckTypeSize)

#test for ansi scope (needed for msvc6)
INCLUDE(TestForANSIForScope)

if(HAVE_SOCKET_H)
  set(type_check_includes ${type_check_includes} socket.h)
endif(HAVE_SOCKET_H)
if(HAVE_SYS_SOCKET_H)
  set(type_check_includes ${type_check_includes} sys/socket.h)
endif(HAVE_SYS_SOCKET_H)
if(HAVE_SYS_TYPES_H)
  set(type_check_includes ${type_check_includes} sys/types.h)
endif(HAVE_SYS_TYPES_H)
if(HAVE_UNISTD_H)
  set(type_check_includes ${type_check_includes} unistd.h)
endif(HAVE_UNISTD_H)
if(HAVE_STDINT_H)
  set(type_check_includes ${type_check_includes} stdint.h)
endif(HAVE_STDINT_H)

SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} ${type_check_includes})
CHECK_TYPE_SIZE(int16_t     INT16_T)
CHECK_TYPE_SIZE(uint16_t    UINT16_T)
CHECK_TYPE_SIZE(int32_t     INT32_T)
CHECK_TYPE_SIZE(uint32_t    UINT32_T)
CHECK_TYPE_SIZE(int64_t     INT64_T)
CHECK_TYPE_SIZE(uint64_t    UINT64_T)

CHECK_TYPE_SIZE(short       SIZEOF_SHORT)
CHECK_TYPE_SIZE(int         SIZEOF_INT)
CHECK_TYPE_SIZE(long        SIZEOF_LONG)
CHECK_TYPE_SIZE("long long" SIZEOF_LONGLONG)
CHECK_TYPE_SIZE(size_t      SIZE_T)
CHECK_TYPE_SIZE(ssize_t     SSIZE_T)

CHECK_TYPE_SIZE(uint        UINT)
CHECK_TYPE_SIZE(intptr_t    INTPTR_T)
CHECK_TYPE_SIZE(socklen_t   SOCKLEN_T)

INCLUDE(MacroBoolTo01)
MACRO_BOOL_TO_01(HAVE_INT16_T   HAVE_INT16_T)
MACRO_BOOL_TO_01(HAVE_UINT16_T  HAVE_UINT16_T)
MACRO_BOOL_TO_01(HAVE_INT32_T   HAVE_INT32_T)
MACRO_BOOL_TO_01(HAVE_UINT32_T  HAVE_UINT32_T)
MACRO_BOOL_TO_01(HAVE_INT64_T   HAVE_INT64_T)
MACRO_BOOL_TO_01(HAVE_UINT64_T  HAVE_UINT64_T)
MACRO_BOOL_TO_01(HAVE_UINT      HAVE_UINT)
MACRO_BOOL_TO_01(HAVE_INTPTR_T  HAVE_INTPTR_T)
MACRO_BOOL_TO_01(HAVE_SOCKLEN_T HAVE_SOCKLEN_T)
MACRO_BOOL_TO_01(HAVE_SIZE_T    HAVE_SIZE_T)
MACRO_BOOL_TO_01(HAVE_SSIZE_T   HAVE_SSIZE_T)
MACRO_BOOL_TO_01(HAVE_STDINT_H  STRIGI_HAVE_STDINT_H)

#now write out our configuration....
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
CONFIGURE_FILE(<commit_msg>fix the type detection (size_t and ssize_t)<commit_after>#need to find a few default headers:
INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(direct.h HAVE_DIRECT_H)          # src/streamindexer/filelister.cpp
CHECK_INCLUDE_FILE_CXX(dirent.h HAVE_DIRENT_H)          # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(dlfcn.h HAVE_DLFCN_H)            # src/streamindexer/analyzerloader.cpp/.h - do we really need it in .h?
CHECK_INCLUDE_FILE_CXX(ndir.h HAVE_NDIR_H)              # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(stddef.h HAVE_STDDEF_H)          # unused !
CHECK_INCLUDE_FILE_CXX(sys/dir.h HAVE_SYS_DIR_H)        # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(sys/ndir.h HAVE_SYS_NDIR_H)      # src/streams/compat/stgdirent.cpp/.h
CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)        # src/streamindexer/filelister.cpp

# files that may define the u?int{8,16,32,54}_t types
CHECK_INCLUDE_FILE_CXX(socket.h HAVE_SOCKET_H)
CHECK_INCLUDE_FILE_CXX(sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILE_CXX(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE_CXX(unistd.h HAVE_UNISTD_H)          # src/streamindexer/pluginendanalyzer.cpp
CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H)          # config.h, jstreamsconfig.h

#test for some functions that are missing on a particular system
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(fchdir HAVE_FCHDIR)               # unused !
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)   # src/luceneindexer/cluceneindexmanager.cpp, src/luceneindexer/cluceneindexreader.cpp, src/streams/compat/timeofday.h
CHECK_FUNCTION_EXISTS(isblank HAVE_ISBLANK)             # src/streams/mailinputstream.cpp, src/streams/compat/compat.cpp
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)         # src/storage/sqlitestorage.cpp, src/daemon/indexscheduler.cpp, src/searchclient/cmdlinestrigi.cpp
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)       # src/streamindexer/expatsaxendanalyzer.cpp, src/streamindexer/saxendanalyzer.cpp
CHECK_FUNCTION_EXISTS(strcasestr HAVE_STRCASESTR)       # src/streams/mailinputstream.cpp
CHECK_FUNCTION_EXISTS(strlwr HAVE_STRLWR)               # src/streamindexer/ifilterendanalyzer.cpp
CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)     # src/streams/mailinputstream.cpp

#test for missing types
INCLUDE(CheckTypeSize)

#test for ansi scope (needed for msvc6)
INCLUDE(TestForANSIForScope)

if(HAVE_SOCKET_H)
  set(type_check_includes ${type_check_includes} socket.h)
endif(HAVE_SOCKET_H)
if(HAVE_SYS_SOCKET_H)
  set(type_check_includes ${type_check_includes} sys/socket.h)
endif(HAVE_SYS_SOCKET_H)
if(HAVE_SYS_TYPES_H)
  set(type_check_includes ${type_check_includes} sys/types.h)
endif(HAVE_SYS_TYPES_H)
if(HAVE_UNISTD_H)
  set(type_check_includes ${type_check_includes} unistd.h)
endif(HAVE_UNISTD_H)
if(HAVE_STDINT_H)
  set(type_check_includes ${type_check_includes} stdint.h)
endif(HAVE_STDINT_H)

SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} ${type_check_includes})
CHECK_TYPE_SIZE(int16_t     INT16_T)
CHECK_TYPE_SIZE(uint16_t    UINT16_T)
CHECK_TYPE_SIZE(int32_t     INT32_T)
CHECK_TYPE_SIZE(uint32_t    UINT32_T)
CHECK_TYPE_SIZE(int64_t     INT64_T)
CHECK_TYPE_SIZE(uint64_t    UINT64_T)

CHECK_TYPE_SIZE(short       SIZEOF_SHORT)
CHECK_TYPE_SIZE(int         SIZEOF_INT)
CHECK_TYPE_SIZE(long        SIZEOF_LONG)
CHECK_TYPE_SIZE("long long" SIZEOF_LONGLONG)
CHECK_TYPE_SIZE(size_t      SIZE_T)
CHECK_TYPE_SIZE(ssize_t     SSIZE_T)

CHECK_TYPE_SIZE(uint        UINT)
CHECK_TYPE_SIZE(intptr_t    INTPTR_T)
CHECK_TYPE_SIZE(socklen_t   SOCKLEN_T)

INCLUDE(MacroBoolTo01)
MACRO_BOOL_TO_01(HAVE_INT16_T   HAVE_INT16_T)
MACRO_BOOL_TO_01(HAVE_UINT16_T  HAVE_UINT16_T)
MACRO_BOOL_TO_01(HAVE_INT32_T   HAVE_INT32_T)
MACRO_BOOL_TO_01(HAVE_UINT32_T  HAVE_UINT32_T)
MACRO_BOOL_TO_01(HAVE_INT64_T   HAVE_INT64_T)
MACRO_BOOL_TO_01(HAVE_UINT64_T  HAVE_UINT64_T)
MACRO_BOOL_TO_01(HAVE_UINT      HAVE_UINT)
MACRO_BOOL_TO_01(HAVE_INTPTR_T  HAVE_INTPTR_T)
MACRO_BOOL_TO_01(HAVE_SOCKLEN_T HAVE_SOCKLEN_T)
MACRO_BOOL_TO_01(HAVE_STDINT_H  STRIGI_HAVE_STDINT_H)
MACRO_BOOL_TO_01(HAVE_SIZE_T    HAVE_SIZE_T)
MACRO_BOOL_TO_01(HAVE_SSIZE_T   HAVE_SSIZE_T)

#now write out our configuration....
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
CONFIGURE_FILE(
{'fraction_non_alphanumeric': 0.07603578154425612, 'fraction_numerical': 0.019303201506591337, 'mean_word_length': 6.08673894912427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7181019', 'n_tokens_mistral': 3640, 'n_tokens_neox': 3339, 'n_words': 415}