# Checking Headers and Functions for fontconfig include( CheckIncludeFile ) include( CheckFunctionExists ) include( CheckSymbolExists ) include( CheckStructHasMember ) include( CheckTypeSize) if(WIN32) if(MSVC) set( CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/win_compat ) set( GETOPT_HEADER "getopt.h") else(MSVC) set( CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/mingw ) set( GETOPT_HEADER "unistd.h") endif(MSVC) else() set(GETOPT_HEADER "unistd.h") endif(WIN32) if(Linux) set(_POSIX_SOURCE 1) set(_GNU_SOURCE 1) endif() if(Solaris) set(_POSIX_PTHREAD_SEMANTICS 1) set(__EXTENSIONS__ 1) endif() check_include_file( "dirent.h" HAVE_DIRENT_H ) check_include_file( "dlfcn.h" HAVE_DLFCN_H ) check_include_file( "fcntl.h" HAVE_FCNTL_H ) check_include_file( "inttypes.h" HAVE_INTTYPES_H ) check_include_file( "memory.h" HAVE_MEMORY_H ) check_include_file( "ndir.h" HAVE_NDIR_H ) check_include_file( "regex.h" HAVE_REGEX_H ) check_include_file( "sched.h" HAVE_SCHED_H ) check_include_file( "stdint.h" HAVE_STDINT_H ) check_include_file( "stdlib.h" HAVE_STDLIB_H ) check_include_file( "strings.h" HAVE_STRINGS_H ) check_include_file( "string.h" HAVE_STRING_H ) check_include_file( "sys/dir.h" HAVE_SYS_DIR_H ) check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H ) check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H ) check_include_file( "sys/param.h" HAVE_SYS_PARAM_H ) check_include_file( "sys/statfs.h" HAVE_SYS_STATFS_H ) check_include_file( "sys/stat.h" HAVE_SYS_STAT_H ) check_include_file( "sys/types.h" HAVE_SYS_TYPES_H ) check_include_file( "sys/vfs.h" HAVE_SYS_VFS_H ) check_include_file( "unistd.h" HAVE_UNISTD_H ) check_include_file( "xmlparse.h" HAVE_XMLPARSE_H ) check_function_exists( chsize HAVE_CHSIZE ) check_function_exists( _doprnt HAVE_DOPRNT ) check_function_exists( _mktemp_s HAVE__MKTEMP_S ) check_function_exists( fstatfs HAVE_FSTATFS ) check_function_exists( fstatvfs HAVE_FSTATVFS ) check_function_exists( ftruncate HAVE_FTRUNCATE ) list(APPEND CMAKE_REQUIRED_LIBRARIES ${FREETYPE_LIBRARIES} ${EXPAT_LIBRARIES} ) list(APPEND CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIR} ${EXPAT_INCLUDE_DIR} ) check_function_exists( FT_Get_BDF_Property HAVE_FT_GET_BDF_PROPERTY ) check_function_exists( FT_Get_Next_Char HAVE_FT_GET_NEXT_CHAR ) check_function_exists( FT_Get_PS_Font_Info HAVE_FT_GET_PS_FONT_INFO ) check_function_exists( FT_Get_X11_Font_Format HAVE_FT_GET_X11_FONT_FORMAT ) check_function_exists( FT_Has_PS_Glyph_Names HAVE_FT_HAS_PS_GLYPH_NAMES ) check_function_exists( FT_Select_Size HAVE_FT_SELECT_SIZE ) list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${FREETYPE_LIBRARIES} ${EXPAT_LIBRARIES} ) list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${FREETYPE_LIBRARIES} ${EXPAT_LIBRARIES} ) check_function_exists( getexecname HAVE_GETEXECNAME ) check_function_exists( geteuid HAVE_GETEUID ) check_symbol_exists( getopt ${GETOPT_HEADER} HAVE_GETOPT) check_symbol_exists( getopt_long ${GETOPT_HEADER} HAVE_GETOPT_LONG) check_function_exists( getpagesize HAVE_GETPAGESIZE ) check_function_exists( getprogname HAVE_GETPROGNAME ) check_function_exists( getuid HAVE_GETUID ) check_function_exists( link HAVE_LINK ) check_function_exists( lrand48 HAVE_LRAND48 ) check_function_exists( lstat HAVE_LSTAT ) check_function_exists( memmove HAVE_MEMMOVE ) check_function_exists( memset HAVE_MEMSET ) check_function_exists( mkdtemp HAVE_MKDTEMP ) check_function_exists( mkostemp HAVE_MKOSTEMP ) check_function_exists( mkstemp HAVE_MKSTEMP ) check_function_exists( mmap HAVE_MMAP ) check_function_exists( posix_fadivse HAVE_POSIX_FADVISE ) check_function_exists( rand HAVE_RAND ) check_function_exists( rand_r HAVE_RAND_R ) check_function_exists( random HAVE_RANDOM ) check_function_exists( random_r HAVE_RANDOM_R ) check_function_exists( readlink HAVE_READLINK ) check_function_exists( regcomp HAVE_REGCOMP ) check_function_exists( regerror HAVE_REGERROR ) check_function_exists( regexec HAVE_REGEXEC ) check_function_exists( regfree HAVE_REGFREE ) check_function_exists( scandir HAVE_SCANDIR ) check_function_exists( strchr HAVE_STRCHR ) check_function_exists( strrchr HAVE_STRRCHR ) check_function_exists( strtol HAVE_STRTOL ) check_function_exists( sysconf HAVE_SYSCONF ) check_function_exists( vprintf HAVE_VPRINTF ) check_function_exists( XML_SetDoctypeDeclHandler HAVE_XML_SETDOCTYPEDECLHANDLER ) check_struct_has_member(dirent d_type "dirent.h" HAVE_STRUCT_DIRENT_D_TYPE) check_struct_has_member(statfs f_flags "sys/statfs.h;sys/vfs.h;sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_FLAGS) check_struct_has_member(statfs f_fstypename "sys/statfs.h;sys/vfs.h;sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_FSTYPENAME) check_struct_has_member(statvfs f_basetype "sys/statvfs.h" HAVE_STRUCT_STATFS_F_FSTYPENAME) check_struct_has_member(statvfs f_fstypename "sys/statvfs.h" HAVE_STRUCT_STATVFS_F_FSTYPENAME) check_type_size("char" SIZEOF_CHAR BUILTIN_TYPES_ONLY) check_type_size("int" SIZEOF_INT BUILTIN_TYPES_ONLY) check_type_size("long" SIZEOF_LONG BUILTIN_TYPES_ONLY) check_type_size("short" SIZEOF_SHORT BUILTIN_TYPES_ONLY) check_type_size("void*" SIZEOF_VOIDP BUILTIN_TYPES_ONLY) check_type_size("void *" SIZEOF_VOID_P BUILTIN_TYPES_ONLY) set(FC_GPERF_SIZE_T "size_t") # Should test like configure.ac that size_t is recognized (but should work for msvc and gcc) add_definitions( -DHAVE_CONFIG_H) add_definitions( -DFONTCONFIG_PATH="\\"${CMAKE_INSTALL_PREFIX}/etc/fonts\\"" ) add_definitions( -DFC_TEMPLATEDIR="fc_template" ) set( FC_DEFAULT_FONTS "\"%WINDIR%/fonts\"" ) set( FC_CACHEDIR "\"%TEMP%/fc_cache\"" ) set( ALIGNOF_VOID_P SIZEOF_VOID_P) set( ALIGNOF_DOUBLE 8) set( HAVE_INTEL_ATOMIC_PRIMITIVES 1) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/fonts.conf.cmake ${CMAKE_CURRENT_BINARY_DIR}/fonts.conf ) #install( FILES ${CMAKE_CURRENT_BINARY_DIR}/fonts.conf DESTINATION etc/fonts )