summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2016-09-16 16:46:01 +0200
committerMilan Crha <mcrha@redhat.com>2016-09-16 16:46:01 +0200
commitf3236ba5baa2c4cf97e56310396208a813d9bad6 (patch)
tree959fca58653446409695a44f7a159b8ed8f8bb39
parent9b4e6f6e10c5111aa1478e53592b144b20bace53 (diff)
downloadevolution-data-server-f3236ba5baa2c4cf97e56310396208a813d9bad6.tar.gz
Initial changes
Nothing builds, this is for configure.ac port, which is still not complete
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt591
-rw-r--r--camel/camel-lock.c20
-rw-r--r--camel/camel-movemail.c10
-rw-r--r--cmake/cmake_uninstall.cmake.in21
-rw-r--r--cmake/modules/CodeCoverageGCOV.cmake39
-rw-r--r--cmake/modules/DistTarget.cmake15
-rw-r--r--cmake/modules/FindKRB5.cmake91
-rw-r--r--cmake/modules/FindSMIME.cmake136
-rw-r--r--cmake/modules/PkgConfigEx.cmake46
-rw-r--r--cmake/modules/PrintableOptions.cmake74
-rw-r--r--cmake/modules/SetupCompilerWarningFlags.cmake70
-rw-r--r--cmake/modules/UninstallTarget.cmake11
-rw-r--r--config.h.in337
-rw-r--r--iconv-detect.c63
15 files changed, 1490 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..378eac25d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..06cfc828c
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,591 @@
+# Evolution-Data-Server build script
+
+cmake_minimum_required(VERSION 3.0)
+cmake_policy(VERSION 3.0)
+
+project(evolution-data-server
+ VERSION 3.23.1
+ LANGUAGES C CXX)
+
+# Base Version: This is for API/version tracking for things like
+# D-Bus server files. This should always be the major/minor of
+# the stable version or stable version to be.
+set(BASE_VERSION 3.24)
+
+# This number is meaningless, but we're now stuck with it in our
+# library names for backward compatibility.
+set(API_VERSION 1.2)
+
+set(GETTEXT_PACKAGE ${PROJECT_NAME}-${BASE_VERSION})
+
+# ******************************
+# D-Bus versioning
+# ******************************
+set(ADDRESS_BOOK_DBUS_SERVICE_NAME "org.gnome.evolution.dataserver.AddressBook9")
+set(CALENDAR_DBUS_SERVICE_NAME "org.gnome.evolution.dataserver.Calendar7")
+set(SOURCES_DBUS_SERVICE_NAME "org.gnome.evolution.dataserver.Sources5")
+set(USER_PROMPTER_DBUS_SERVICE_NAME "org.gnome.evolution.dataserver.UserPrompter0")
+
+# ******************************
+# Library versioning
+# ******************************
+set(LIBCAMEL_CURRENT 59)
+set(LIBCAMEL_REVISION 0)
+set(LIBCAMEL_AGE 0)
+
+set(LIBEBACKEND_CURRENT 10)
+set(LIBEBACKEND_REVISION 0)
+set(LIBEBACKEND_AGE 0)
+
+set(LIBEDATASERVER_CURRENT 22)
+set(LIBEDATASERVER_REVISION 0)
+set(LIBEDATASERVER_AGE 0)
+
+set(LIBEDATASERVERUI_CURRENT 1)
+set(LIBEDATASERVERUI_REVISION 0)
+set(LIBEDATASERVERUI_AGE 0)
+
+set(LIBEBOOK_CURRENT 19)
+set(LIBEBOOK_REVISION 1)
+set(LIBEBOOK_AGE 3)
+
+set(LIBEBOOK_CONTACTS_CURRENT 2)
+set(LIBEBOOK_CONTACTS_REVISION 0)
+set(LIBEBOOK_CONTACTS_AGE 0)
+
+set(LIBEDATABOOK_CURRENT 25)
+set(LIBEDATABOOK_REVISION 0)
+set(LIBEDATABOOK_AGE 0)
+
+set(LIBECAL_CURRENT 19)
+set(LIBECAL_REVISION 0)
+set(LIBECAL_AGE 0)
+
+set(LIBEDATACAL_CURRENT 28)
+set(LIBEDATACAL_REVISION 0)
+set(LIBEDATACAL_AGE 0)
+
+# Keep these two definitions in agreement.
+set(glib_minimum_version 2.46)
+set(glib_encoded_version GLIB_VERSION_2_46)
+
+# Keep these two definitions in agreement.
+set(gdk_minimum_version 3.10)
+set(gdk_encoded_version GDK_VERSION_3_10)
+
+# Keep these two definitions in agreement.
+set(soup_minimum_version 2.42)
+set(soup_encoded_version SOUP_VERSION_2_42)
+
+# Warn about API usage that violates our minimum requirements.
+add_definitions(-DGLIB_VERSION_MAX_ALLOWED=${glib_encoded_version})
+add_definitions(-DGDK_VERSION_MAX_ALLOWED=${gdk_encoded_version})
+add_definitions(-DSOUP_VERSION_MAX_ALLOWED=${soup_encoded_version})
+
+# These will suppress warnings about newly-deprecated symbols. Ideally
+# these settings should match our minimum requirements and we will clean
+# up any new deprecation warnings after bumping our minimum requirements.
+# But if the warnings get to be overwhelming, use fixed versions instead.
+add_definitions(-DGLIB_VERSION_MIN_REQUIRED=${glib_encoded_version})
+add_definitions(-DGDK_VERSION_MIN_REQUIRED=${gdk_encoded_version})
+add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
+
+set(gcr_minimum_version 3.4)
+set(libgdata_minimum_version 0.10)
+set(libical_minimum_version 0.43)
+set(libsecret_minimum_version 0.5)
+set(libxml_minimum_version 2.0.0)
+set(sqlite_minimum_version 3.7.17)
+
+# Optional Packages
+set(goa_minimum_version 3.8)
+set(gweather_minimum_version 3.10)
+set(libaccounts_glib_minimum_version 1.4)
+set(libsignon_glib_minimum_version 1.8)
+set(json_glib_minimum_version 1.0.4)
+set(webkit2gtk_minimum_version 2.11.91)
+
+# Load modules from the source tree
+set(CMAKE_MODULE_PATH $CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+# CMake modules
+include(CheckCCompilerFlag)
+include(CheckCSourceCompiles)
+include(CheckCSourceRuns)
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+
+# Project custom modules
+include(PrintableOptions)
+
+add_printable_variable(LIB_SUFFIX "Library directory suffix, usually defined to '64' for x86_64 systems" "")
+add_printable_variable_custom(CMAKE_INSTALL_PREFIX)
+add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header files, defaults to CMAKE_INSTALL_PREFIX/include" ${CMAKE_INSTALL_PREFIX}/include)
+add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to CMAKE_INSTALL_PREFIX/libexec" ${CMAKE_INSTALL_PREFIX}/libexec)
+add_printable_variable_path(SHARE_INSTALL_PREFIX "Install directory for shared files, defaults to CMAKE_INSTALL_PREFIX/share" ${CMAKE_INSTALL_PREFIX}/share)
+add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults to CMAKE_INSTALL_PREFIX/etc" ${CMAKE_INSTALL_PREFIX}/etc)
+
+include(CodeCoverageGCOV)
+include(DistTarget)
+include(PkgConfigEx)
+include(SetupCompilerWarningFlags)
+include(UninstallTarget)
+
+include(FindKRB5)
+include(FindSMIME)
+
+add_printable_option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" OFF)
+
+# Compiler warning flags
+setup_compiler_warning_flags(${ENABLE_MAINTAINER_MODE})
+
+check_c_compiler_flag(-fno-strict-aliasing _flag_supported)
+if(_flag_supported)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
+endif(_flag_supported)
+unset(_flag_supported)
+
+CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H)
+CHECK_INCLUDE_FILE(wspiapi.h HAVE_WSPIAPI_H)
+CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
+CHECK_FUNCTION_EXISTS(strptime HAVE_STRPTIME)
+CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
+
+pkg_check_modules(GNOME_PLATFORM
+ gio-2.0>=${glib_minimum_version}
+ gmodule-2.0>=${glib_minimum_version}
+ libxml-2.0>=${libxml_minimum_version}
+ libsoup-2.4>=${soup_minimum_version}
+)
+
+if(WIN32)
+ pkg_check_modules(GIO_UNIX gio-windows-2.0)
+else(WIN32)
+ pkg_check_modules(GIO_UNIX gio-unix-2.0)
+endif(WIN32)
+
+# ******************************
+# Check for libphonenumber
+# ******************************
+
+# *******************
+# Check for ICU
+# *******************
+#
+# ICU started shipping pkg-config files but it's not present
+# on many systems, if we don't find the pkg-config
+# file then let's fallback on a manual check
+pkg_check_modules(ICU icu-i18n)
+
+if(NOT ICU_FOUND)
+ CHECK_INCLUDE_FILE(unicode/ucol.h HAVE_UNICODE_UCOL_H)
+ if(NOT HAVE_UNICODE_UCOL_H)
+ message(FATAL_ERROR "ICU unicode/ucol.h not found; icu-i18n is required")
+ endif(HAVE_UNICODE_UCOL_H)
+
+ set(CMAKE_REQUIRED_LIBRARIES "-licui18n -licuuc -licudata")
+ CHECK_C_SOURCE_COMPILES("#include <unicode/ucol.h>
+ int main(void) { ucol_open (\"\", NULL); return 0; }" HAVE_UCOL_OPEN)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+
+ if(HAVE_UCOL_OPEN)
+ set(ICU_CFLAGS -D_REENTRANT)
+ set(ICU_LIBS "-licui18n -licuuc -licudata")
+ else(HAVE_UCOL_OPEN)
+ message(FATAL_ERROR "Failed to find icu-i18n, install its development files or build them first")
+ endif(HAVE_UCOL_OPEN)
+endif(NOT ICU_FOUND)
+
+# *************************
+# Check for GTK+
+# *************************
+
+add_printable_option(ENABLE_GTK "Enable gtk+ support" ON)
+
+if(ENABLE_GTK)
+ pkg_check_modules_for_option(ENABLE_GTK "GTK+ support" GTK gtk+-3.0>=${gdk_minimum_version})
+ pkg_check_modules_for_option(ENABLE_GTK "GTK+ support" GCR gcr-3>=${gcr_minimum_version})
+
+ set(HAVE_GTK 1)
+endif(ENABLE_GTK)
+
+# ***************************************************
+# Check for WebKitGTK+ and json-glib for google auth
+# ***************************************************
+
+add_printable_option(ENABLE_GOOGLE_AUTH "Enable built-in Google authentication" ON)
+
+if(ENABLE_GOOGLE_AUTH)
+ pkg_check_modules_for_option(ENABLE_GOOGLE_AUTH "Google authentication support" GOOGLE_AUTH
+ webkit2gtk-4.0>=${webkit2gtk_minimum_version}
+ json-glib-1.0>=${json_glib_minimum_version}
+ )
+
+ add_printable_variable(WITH_GOOGLE_CLIENT_ID "Google OAuth 2.0 client id" "")
+ add_printable_variable(WITH_GOOGLE_CLIENT_SECRET "Google OAuth 2.0 client secret" "")
+
+ if(WITH_GOOGLE_CLIENT_ID STREQUAL "")
+ set(WITH_GOOGLE_CLIENT_ID "590402290962-2i0b7rqma8b9nmtfrcp7fa06g6cf7g74.apps.googleusercontent.com")
+ endif(WITH_GOOGLE_CLIENT_ID STREQUAL "")
+
+ if(WITH_GOOGLE_CLIENT_SECRET STREQUAL "")
+ set(WITH_GOOGLE_CLIENT_SECRET "mtfUe5W8Aal9DcgVipOY1T9G")
+ endif(WITH_GOOGLE_CLIENT_SECRET STREQUAL "")
+endif(ENABLE_GOOGLE_AUTH)
+
+# ******************************************
+# Check whether to build examples/demos
+# ******************************************
+
+add_printable_option(ENABLE_EXAMPLES "Enable the build of examples" ON)
+
+if(ENABLE_EXAMPLES)
+ pkg_check_modules_for_option(ENABLE_EXAMPLES "build the example program(s)" EXAMPLES
+ gtk+-3.0>=3.10
+ glib-2.0>=2.38
+ )
+
+ set(BUILD_EXAMPLES 1)
+endif(ENABLE_EXAMPLES)
+
+# *******************************
+# Check for GNOME Online Accounts
+# *******************************
+
+add_printable_option(ENABLE_GOA "Enable GNOME Online Accounts support" ON)
+
+if(ENABLE_GOA)
+ pkg_check_modules_for_option(ENABLE_GOA "GNOME Online Accounts support" GOA goa-1.0>=${goa_minimum_version})
+
+ set(HAVE_GOA 1)
+endif(ENABLE_GOA)
+
+# ********************************
+# Check for Ubuntu Online Accounts
+# ********************************
+
+add_printable_option(ENABLE_UOA "Enable Ubuntu Online Accounts support" ON)
+
+if(ENABLE_UOA)
+ pkg_check_modules_for_option(ENABLE_UOA "Ubuntu Online Accounts support" LIBACCOUNTS_GLIB libaccounts-glib>=${libaccounts_glib_minimum_version})
+ pkg_check_modules_for_option(ENABLE_UOA "Ubuntu Online Accounts support" LIBSIGNON_GLIB libsignon-glib>=${libsignon_glib_minimum_version})
+ pkg_check_modules_for_option(ENABLE_UOA "Ubuntu Online Accounts support" JSON_GLIB json-glib-1.0)
+ pkg_check_modules_for_option(ENABLE_UOA "Ubuntu Online Accounts support" REST rest-0.7)
+
+ set(HAVE_UOA 1)
+endif(ENABLE_UOA)
+
+# **********************************************
+# Check if backend per process should be enabled
+# **********************************************
+
+add_printable_option(ENABLE_BACKEND_PER_PROCESS "Enable backend per process support" ON)
+
+# ***********************************
+# Check for libsecret and gcr-base
+# ***********************************
+
+if(NOT WIN32)
+ pkg_check_modules(LIBSECRET REQUIRED libsecret-unstable>=${libsecret_minimum_version})
+ pkg_check_modules(GCR_BASE REQUIRED gcr-base-3>=${gcr_minimum_version})
+endif(NOT WIN32)
+
+# ******************************
+# libdb checking
+# ******************************
+add_printable_variable(WITH_LIBDB "Prefix where libdb is installed" "")
+
+if(NOT ("${WITH_LIBDB}" STREQUAL "NO"))
+ if(NOT (("${WITH_LIBDB}" STREQUAL "") OR ("${WITH_LIBDB}" STREQUAL "YES")))
+ set(LIBDB_CFLAGS "-I${WITH_LIBDB}/include")
+ set(LIBDB_LIBS "-L${WITH_LIBDB}/lib -ldb")
+ else(NOT (("${WITH_LIBDB}" STREQUAL "") OR ("${WITH_LIBDB}" STREQUAL "YES")))
+ if(("$ENV{DB_CFLAGS}" STREQUAL "") AND ("$ENV{DB_LIBS}" STREQUAL ""))
+ set(LIBDB_CFLAGS "")
+ set(LIBDB_LIBS "-ldb")
+ else(("$ENV{DB_CFLAGS}" STREQUAL "") AND ("$ENV{DB_LIBS}" STREQUAL ""))
+ set(LIBDB_CFLAGS $ENV{DB_CFLAGS})
+ set(LIBDB_LIBS $ENV{DB_LIBS})
+ endif(("$ENV{DB_CFLAGS}" STREQUAL "") AND ("$ENV{DB_LIBS}" STREQUAL ""))
+ endif(NOT (("${WITH_LIBDB}" STREQUAL "") OR ("${WITH_LIBDB}" STREQUAL "YES")))
+
+ set(CMAKE_REQUIRED_FLAGS ${LIBDB_CFLAGS})
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBDB_LIBS})
+ CHECK_C_SOURCE_COMPILES("#include <db.h>
+ int main(void) { db_create(NULL, NULL, 0); return 0; }" HAVE_LIBDB)
+ unset(CMAKE_REQUIRED_FLAGS)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+endif(NOT ("${WITH_LIBDB}" STREQUAL "NO"))
+
+# ******************************
+# iconv checking
+# ******************************
+
+set(CMAKE_REQUIRED_LIBRARIES "-liconv")
+CHECK_C_SOURCE_COMPILES("#include <iconv.h>
+ #include <stdlib.h>
+ int main(void) { iconv_t cd; cd = iconv_open (\"UTF-8\", \"ISO-8859-1\"); return 0; }" HAVE_LIBICONV)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
+if(HAVE_LIBICONV)
+ set(ICONV_LIBS "-liconv")
+ set(HAVE_ICONV ON)
+else(HAVE_LIBICONV)
+ set(ICONV_LIBS "")
+ CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV)
+endif(HAVE_LIBICONV)
+
+if(NOT HAVE_ICONV)
+ message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
+endif(NOT HAVE_ICONV)
+
+set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
+CHECK_C_SOURCE_RUNS("#include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
+if(NOT _correct_iconv)
+ message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
+endif(NOT _correct_iconv)
+
+# ******************************
+# Backtraces for debugging
+# ******************************
+
+add_printable_option(ENABLE_BACKTRACES "Enable backtraces for camel_pointer_tracker" OFF)
+
+if(ENABLE_BACKTRACES)
+ CHECK_C_SOURCE_COMPILES("#include <execinfo.h>
+ int main(void) { void *bt[1]; backtrace_symbols (bt, backtrace(bt, 1)); return 0; }" _have_bsf)
+
+ if(_have_bsf)
+ set(CMAKE_REQUIRED_LIBRARIES -ldw)
+ CHECK_C_SOURCE_COMPILES("#include <elfutils/libdwfl.h>
+ int main(void) {
+ Dwfl *dwfl;
+ Dwfl_Module *module;
+ Dwarf_Addr module_low_addr;
+ Dwfl_Line *line;
+
+ dwfl_standard_find_debuginfo;
+ dwfl_linux_proc_find_elf;
+ dwfl_begin (NULL);
+ dwfl_linux_proc_report (NULL, 1);
+ dwfl_report_end (NULL, NULL, NULL);
+ dwfl_end (NULL);
+ dwfl_module_addrname (NULL, NULL);
+ dwfl_module_getsrc (NULL, NULL);
+ dwfl_lineinfo (NULL, NULL, NULL, NULL, NULL, NULL);
+ DWARF_CB_ABORT; DWARF_CB_OK;
+ dwfl_getmodules (NULL, NULL, NULL, 0);
+ return 0; }" _have_elfdwlf)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+
+ if(_have_elfdwlf)
+ set(HAVE_ELFUTILS_LIBDWFL ON)
+ set(LIBDWFL_LIBS "-ldw")
+ endif(_have_elfdwlf)
+ endif(_have_bsf)
+endif(ENABLE_BACKTRACES)
+
+# ******************************
+# Check for nl_langinfo features
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
+ int main(void) { char *detail = nl_langinfo (CODESET); return 0; }" HAVE_CODESET)
+
+CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
+ int main(void) { char *detail = nl_langinfo (_NL_ADDRESS_COUNTRY_AB2); return 0; }" HAVE__NL_ADDRESS_COUNTRY_AB2)
+
+# *******************************************************
+# Check to see if strftime supports the use of %l and %k
+# *******************************************************
+
+CHECK_C_SOURCE_RUNS("
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+ int main(int argc, char **argv) {
+ char buf[10];
+ time_t rawtime;
+ struct tm *timeinfo;
+
+ time(&rawtime);
+ timeinfo=localtime(&rawtime);
+ buf[0] = 0;
+ strftime(buf, 10, \"%lx%k\", timeinfo);
+
+ if (!buf[0] || buf[0] == 'x' || strstr(buf, \"l\") || strstr(buf, \"k\"))
+ return 1;
+ return 0;
+ }" HAVE_LKSTRFTIME)
+
+# ******************************
+# system mail stuff
+# ******************************
+
+find_program(SENDMAIL_PATH sendmail /usr/sbin /usr/lib)
+find_path(SYSTEM_MAIL_DIR /var/mail /var/spool/mail)
+
+# ******************************
+# Timezone checks
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <time.h>
+ int main(void) { struct tm tm; tm.tm_gmtoff = 1; return 0; }" HAVE_TM_GMTOFF)
+
+CHECK_C_SOURCE_COMPILES("#include <time.h>
+ int main(void) { timezone = 1; return 0; }" HAVE_TIMEZONE)
+
+CHECK_C_SOURCE_COMPILES("#include <time.h>
+ int main(void) { altzone = 1; return 0; }" HAVE_ALTZONE)
+
+if((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
+ message(FATAL_ERROR "Unable to find a way to determine timezone")
+endif((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
+
+# ******************************
+# gethostbyaddr_r prototype
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #define BUFSIZE (sizeof(struct hostent)+10)
+
+ int main(void) {
+ struct hostent hent;
+ char buffer[BUFSIZE];
+ int bufsize=BUFSIZE;
+ int h_errno;
+ (void)gethostbyaddr_r (\"www.ximian.com\", 14, AF_INET, &hent, buffer, bufsize, &h_errno);
+ return 0;
+ }" GETHOSTBYADDR_R_SEVEN_ARGS)
+
+# ******************************
+# gethostbyname_r prototype
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #define BUFSIZE (sizeof(struct hostent)+10)
+
+ int main(void) {
+ struct hostent hent;
+ char buffer[BUFSIZE];
+ int bufsize=BUFSIZE;
+ int h_errno;
+ (void)gethostbyname_r (\"www.ximian.com\", &hent, buffer, bufsize, &h_errno);
+ return 0;
+ }" GETHOSTBYNAME_R_FIVE_ARGS)
+
+# ******************************
+# IPv6 support and getaddrinfo calls
+# ******************************
+
+add_printable_option(ENABLE_IPV6 "Enable IPv6 support" ON)
+
+CHECK_C_SOURCE_COMPILES("#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <stddef.h>
+
+ int main(void) {
+ #ifndef NI_MAXHOST
+ #define NI_MAXHOST 1025
+ #endif
+
+ #ifndef NI_MAXSERV
+ #define NI_MAXSERV 32
+ #endif
+
+ struct addrinfo hints, *res;
+ struct sockaddr_in6 sin6;
+ int af = AF_INET6;
+ char host[NI_MAXHOST];
+ char serv[NI_MAXSERV];
+
+ getaddrinfo (\"www.ximian.com\", NULL, &hints, &res);
+ freeaddrinfo (res);
+ getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), host, sizeof(host), serv, sizeof(serv), 0);
+ return 0;
+ }" have_addrinfo)
+
+if(NOT have_addrinfo)
+ set(NEED_ADDRINFO ON)
+ if(ENABLE_IPV6)
+ message(FATAL_ERROR "System doesn't support necessary interfaces for IPv6 support. Use -DENABLE_IPV6=OFF to disable IPv6 support.")
+ endif(ENABLE_IPV6)
+else(NOT have_addrinfo)
+ if(ENABLE_IPV6)
+ CHECK_C_SOURCE_COMPILES("#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+
+ int main(void) {
+ struct addrinfo hints;
+ hints.ai_flags = AI_ADDRCONFIG;
+ return 0;
+ }" HAVE_AI_ADDRCONFIG)
+ endif(ENABLE_IPV6)
+endif(NOT have_addrinfo)
+
+# **********************************
+# Weather calendar backend support
+# **********************************
+
+add_printable_option(ENABLE_WEATHER "Build the weather calendar backend" ON)
+
+if(ENABLE_WEATHER)
+ pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar backend" LIBGWEATHER gweather-3.0>=${gweather_minimum_version})
+endif(ENABLE_WEATHER)
+
+# ******************************
+# File locking
+# ******************************
+
+add_printable_option(ENABLE_DOT_LOCKING "Enable support for locking mail files with dot locking" ON)
+
+if(WIN32 AND ENABLE_DOT_LOCKING)
+ message(WARNING "Auto-disabling dot locking for mail files for this platform")
+ set(ENABLE_DOT_LOCKING OFF)
+ set(USE_DOT_LOCKING OFF)
+else(WIN32 AND ENABLE_DOT_LOCKING)
+ set(USE_DOT_LOCKING ENABLE_DOT_LOCKING)
+endif(WIN32 AND ENABLE_DOT_LOCKING)
+
+add_printable_variable(ENABLE_FILE_LOCKING "Enable support for locking mail files with file locking (one of fcntl/flock/no)" "fcntl")
+
+if(NOT WIN32)
+ if (${ENABLE_FILE_LOCKING} STREQUAL "fcntl")
+ set(USE_FCNTL_LOCKING ON)
+ elseif(${ENABLE_FILE_LOCKING} STREQUAL "flock")
+ set(USE_FLOCK_LOCKING ON)
+ endif()
+endif(NOT WIN32)
+
+# ******************************
+# sendmail operation
+# ******************************
+
+set(defval OFF)
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOs")
+ set(defval ON)
+endif(CMAKE_SYSTEM_NAME STREQUAL "SunOs")
+
+add_printable_option(ENABLE_BROKEN_SPOOL "Use SunOS/Solaris sendmail which has a broken spool format" ${defval})
+
+unset(defval)
+
+# Generate the config.h file
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
+
+add_definitions(-DHAVE_CONFIG_H=1)
+
+print_build_options()
diff --git a/camel/camel-lock.c b/camel/camel-lock.c
index 0307bc188..14a13e52e 100644
--- a/camel/camel-lock.c
+++ b/camel/camel-lock.c
@@ -29,18 +29,18 @@
#include <time.h>
#include <sys/stat.h>
-#ifdef USE_DOT
+#ifdef USE_DOT_LOCKING
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
-#ifdef USE_FCNTL
+#ifdef USE_FCNTL_LOCKING
#include <fcntl.h>
#include <unistd.h>
#endif
-#ifdef USE_FLOCK
+#ifdef USE_FLOCK_LOCKING
#include <sys/file.h>
#endif
@@ -76,7 +76,7 @@ gint
camel_lock_dot (const gchar *path,
GError **error)
{
-#ifdef USE_DOT
+#ifdef USE_DOT_LOCKING
gchar *locktmp, *lock;
gsize lock_len = 0;
gsize locktmp_len = 0;
@@ -153,7 +153,7 @@ camel_lock_dot (const gchar *path,
_("Timed out trying to get lock file on %s. "
"Try again later."), path);
return -1;
-#else /* !USE_DOT */
+#else /* !USE_DOT_LOCKING */
return 0;
#endif
}
@@ -167,7 +167,7 @@ camel_lock_dot (const gchar *path,
void
camel_unlock_dot (const gchar *path)
{
-#ifdef USE_DOT
+#ifdef USE_DOT_LOCKING
gchar *lock;
gsize lock_len;
@@ -197,7 +197,7 @@ camel_lock_fcntl (gint fd,
CamelLockType type,
GError **error)
{
-#ifdef USE_FCNTL
+#ifdef USE_FCNTL_LOCKING
struct flock lock;
d (printf ("fcntl locking %d\n", fd));
@@ -236,7 +236,7 @@ camel_lock_fcntl (gint fd,
void
camel_unlock_fcntl (gint fd)
{
-#ifdef USE_FCNTL
+#ifdef USE_FCNTL_LOCKING
struct flock lock;
d (printf ("fcntl unlocking %d\n", fd));
@@ -265,7 +265,7 @@ camel_lock_flock (gint fd,
CamelLockType type,
GError **error)
{
-#ifdef USE_FLOCK
+#ifdef USE_FLOCK_LOCKING
gint op;
d (printf ("flock locking %d\n", fd));
@@ -296,7 +296,7 @@ camel_lock_flock (gint fd,
void
camel_unlock_flock (gint fd)
{
-#ifdef USE_FLOCK
+#ifdef USE_FLOCK_LOCKING
d (printf ("flock unlocking %d\n", fd));
CHECK_CALL (flock (fd, LOCK_UN));
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
index 9e4d06716..746132a03 100644
--- a/camel/camel-movemail.c
+++ b/camel/camel-movemail.c
@@ -57,7 +57,7 @@ static void movemail_external (const gchar *source, const gchar *dest,
GError **error);
#endif
-#ifdef HAVE_BROKEN_SPOOL
+#ifdef ENABLE_BROKEN_SPOOL
static gint camel_movemail_copy_filter (gint fromfd, gint tofd, goffset start, gsize bytes, CamelMimeFilter *filter);
static gint camel_movemail_solaris (gint oldsfd, gint dfd, GError **error);
#else
@@ -147,7 +147,7 @@ camel_movemail (const gchar *source,
return -1;
}
-#ifdef HAVE_BROKEN_SPOOL
+#ifdef ENABLE_BROKEN_SPOOL
res = camel_movemail_solaris (sfd, dfd, ex);
#else
res = camel_movemail_copy_file (sfd, dfd, error);
@@ -256,7 +256,7 @@ movemail_external (const gchar *source,
}
#endif
-#ifndef HAVE_BROKEN_SPOOL
+#ifndef ENABLE_BROKEN_SPOOL
static gint
camel_movemail_copy_file (gint sfd,
gint dfd,
@@ -358,7 +358,7 @@ camel_movemail_copy (gint fromfd,
#define PRE_SIZE (32)
-#ifdef HAVE_BROKEN_SPOOL
+#ifdef ENABLE_BROKEN_SPOOL
static gint
camel_movemail_copy_filter (gint fromfd,
gint tofd,
@@ -574,5 +574,5 @@ fail:
return -1;
}
-#endif /* HAVE_BROKEN_SPOOL */
+#endif /* ENABLE_BROKEN_SPOOL */
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 000000000..2037e3653
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+ endif(NOT "${rm_retval}" STREQUAL 0)
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/cmake/modules/CodeCoverageGCOV.cmake b/cmake/modules/CodeCoverageGCOV.cmake
new file mode 100644
index 000000000..1c7801f54
--- /dev/null
+++ b/cmake/modules/CodeCoverageGCOV.cmake
@@ -0,0 +1,39 @@
+# CodeCoverageGCOV.cmake
+#
+# Adds options ENABLE_CODE_COVERAGE, which builds the project with
+# code coverage support
+#
+# It sets variables:
+# CODE_COVERAGE_DEFINES - to be used with target_compile_definitions() and similar
+# CODE_COVERAGE_CFLAGS - to be used with target_compile_options() and similar for C code
+# CODE_COVERAGE_CXXFLAGS - to be used with target_compile_options() and similar for C++ code
+# CODE_COVERAGE_LDFLAGS - to be used with target_link_libraries() and similar
+#
+# These variables should be added as the last in the options, because they change compilation
+
+include(CheckLibraryExists)
+include(PrintableOptions)
+
+add_printable_option(ENABLE_CODE_COVERAGE "Enable build with GCOV code coverage" OFF)
+
+if(ENABLE_CODE_COVERAGE)
+ if("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+ CHECK_LIBRARY_EXISTS("gcov" "gcov_exit" "" HAVE_GCOV_LIBRARY)
+ if(HAVE_GCOV_LIBRARY)
+ set(CODE_COVERAGE_DEFINES "-DNDEBUG")
+ set(CODE_COVERAGE_CFLAGS "-O0 -g -fprofile-arcs -ftest-coverage")
+ set(CODE_COVERAGE_CXXFLAGS "-O0 -g -fprofile-arcs -ftest-coverage")
+ set(CODE_COVERAGE_LDFLAGS "-lgcov")
+ else(HAVE_GCOV_LIBRARY)
+ message(FATAL_ERROR "Cannot fing gcov library, use -DENABLE_CODE_COVERAGE=OFF disable it")
+ endif(HAVE_GCOV_LIBRARY)
+
+ else("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+ message(FATAL_ERROR "Code coverage requires gcc compiler, use -DENABLE_CODE_COVERAGE=OFF disable it")
+ endif("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+else(ENABLE_CODE_COVERAGE)
+ set(CODE_COVERAGE_DEFINES "")
+ set(CODE_COVERAGE_CFLAGS "")
+ set(CODE_COVERAGE_CXXFLAGS "")
+ set(CODE_COVERAGE_LDFLAGS "")
+endif(ENABLE_CODE_COVERAGE)
diff --git a/cmake/modules/DistTarget.cmake b/cmake/modules/DistTarget.cmake
new file mode 100644
index 000000000..98adf487f
--- /dev/null
+++ b/cmake/modules/DistTarget.cmake
@@ -0,0 +1,15 @@
+# DistTarget.cmake
+#
+# Defines a custom target 'dist', which generates the dist tarball from a git clone
+# It requires to have populated 'PROJECT_NAME' and 'PROJECT_VERSION' variables,
+# possibly through the project() command
+
+# Filenames for tarball
+set(ARCHIVE_BASE_NAME ${PROJECT_NAME}-${PROJECT_VERSION})
+set(ARCHIVE_FULL_NAME ${ARCHIVE_BASE_NAME}.tar.xz)
+
+add_custom_target(
+ dist
+ COMMAND git archive --prefix=${ARCHIVE_BASE_NAME}/ HEAD | xz -z > ${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+)
diff --git a/cmake/modules/FindKRB5.cmake b/cmake/modules/FindKRB5.cmake
new file mode 100644
index 000000000..4f1072af2
--- /dev/null
+++ b/cmake/modules/FindKRB5.cmake
@@ -0,0 +1,91 @@
+# FindKRB5.cmake
+#
+# Searches for KRB5 library
+#
+# The output is:
+# HAVE_KRB5 - set to ON, if Kerberos 5 support is enabled and libraries found
+# HAVE_MIT_KRB5 - set to ON, when found MIT implementation
+# HAVE_HEIMDAL_KRB5 - set to ON, when found Heimdal implementation
+# KRB5_CFLAGS - CFLAGS to use with target_compile_options() and similarcomands
+# KRB5_LDFLAGS - LDFLAGS to use with target_link_libraries() and similar commands
+
+include(CheckCSourceCompiles)
+include(PkgConfigEx)
+include(PrintableOptions)
+
+add_printable_variable(WITH_KRB5 "Location of Kerberos 5 install dir, defaults to ON to search for it" "ON")
+add_printable_variable_path(WITH_KRB5_INCLUDES "Location of Kerberos 5 headers" "")
+add_printable_variable_path(WITH_KRB5_LIBS "Location of Kerberos 5 libraries" "")
+
+if(NOT WITH_KRB5)
+ return()
+endif(NOT WITH_KRB5)
+
+#pkg_check_modules(KRB5 krb5 krb5-gssapi)
+
+if(KRB5_FOUND)
+ pkg_check_variable(KRB5_VENDOR krb5 vendor)
+
+ if(KRB5_VENDOR STREQUAL "MIT")
+ set(HAVE_MIT_KRB5 ON)
+ return()
+ endif(KRB5_VENDOR STREQUAL "MIT")
+endif()
+
+if("${WITH_KRB5}" STREQUAL "ON")
+ set(WITH_KRB5 "/usr")
+endif("${WITH_KRB5}" STREQUAL "ON")
+
+set(mit_includes "${WITH_KRB5}/include")
+set(mit_libs "-lkrb5 -lk5crypto -lcom_err -lgssapi_krb5")
+set(heimdal_includes "${WITH_KRB5}/include/heimdal")
+set(heimdal_libs "-lkrb5 -lcrypto -lasn1 -lcom_err -lroken -lgssapi")
+set(sun_includes "${WITH_KRB5}/include/kerberosv5")
+set(sun_libs "-lkrb5 -lgss")
+
+set(krb_libs "${WITH_KRB5}/lib${LIB_SUFFIX}")
+
+if(NOT (WITH_KRB5_INCLUDES STREQUAL ""))
+ set(mit_includes "${WITH_KRB5_INCLUDES}")
+ set(heimdal_includes "${WITH_KRB5_INCLUDES}")
+ set(sun_includes "${WITH_KRB5_INCLUDES}")
+endif(NOT (WITH_KRB5_INCLUDES STREQUAL ""))
+
+if(NOT (WITH_KRB5_LIBS STREQUAL ""))
+ set(krb_libs "${WITH_KRB5_LIBS}")
+endif(NOT (WITH_KRB5_LIBS STREQUAL ""))
+
+set(CMAKE_REQUIRED_INCLUDES "-I${mit_includes}")
+set(CMAKE_REQUIRED_LIBRARIES "-L${krb_libs} ${mit_libs}")
+CHECK_C_SOURCE_COMPILES("#include <krb5/krb5.h>
+ int main(void) { krb5_init_context (NULL); return 0; }" HAVE_KRB5)
+
+if(HAVE_KRB5)
+ set(HAVE_MIT_KRB5 ON)
+else(HAVE_KRB5)
+ set(CMAKE_REQUIRED_INCLUDES "-I${heimdal_includes}")
+ set(CMAKE_REQUIRED_LIBRARIES "-L${krb_libs} ${heimdal_libs}")
+ CHECK_C_SOURCE_COMPILES("#include <krb5.h>
+ int main(void) { krb5_init_context (NULL); return 0; }" HAVE_KRB5)
+
+ if(HAVE_KRB5)
+ set(HAVE_HEIMDAL_KRB5 ON)
+ endif(HAVE_KRB5)
+endif(HAVE_KRB5)
+
+if(NOT HAVE_KRB5)
+ set(CMAKE_REQUIRED_INCLUDES "-I${sun_includes}")
+ set(CMAKE_REQUIRED_LIBRARIES "-L${krb_libs} ${sun_libs}")
+ CHECK_C_SOURCE_COMPILES("#include <krb5/krb5.h>
+ int main(void) { krb5_init_context (NULL); return 0; }" HAVE_KRB5)
+endif(NOT HAVE_KRB5)
+
+if(HAVE_KRB5)
+ set(KRB5_CFLAGS ${CMAKE_REQUIRED_INCLUDES})
+ set(KRB5_LDFLAGS ${CMAKE_REQUIRED_LIBRARIES})
+else(HAVE_KRB5)
+ message(FATAL_ERROR "Failed to find Kerberos 5 libraries. Use -DWITH_KRB5=OFF to disable Kerberos 5 support")
+endif(HAVE_KRB5)
+
+unset(CMAKE_REQUIRED_LIBRARIES)
+unset(CMAKE_REQUIRED_INCLUDES)
diff --git a/cmake/modules/FindSMIME.cmake b/cmake/modules/FindSMIME.cmake
new file mode 100644
index 000000000..043dfed6f
--- /dev/null
+++ b/cmake/modules/FindSMIME.cmake
@@ -0,0 +1,136 @@
+# FindSMIME.cmake
+#
+# Searches for Mozilla's NSS and NSPR libraries, unless -DENABLE_SMIME=OFF is used
+#
+# The output is:
+# mozilla_nspr - if non-empty, then a pkg-config package name for nspr
+# mozilla_nss - if non-empty, then a pkg-config package name for nss
+# MANUAL_NSPR_INCLUDES - if non-empty, then contains manual nspr include directory, used for target_include_directories() and similar commands
+# MANUAL_NSPR_LIBS - if non-empty, then contains manual nspr libraries, used for target_link_libraries() and similar commands
+# MANUAL_NSS_INCLUDES - if non-empty, then contains manual nss include directory, used for target_include_directories() and similar commands
+# MANUAL_NSS_LIBS - if non-empty, then contains manual nss libraries, used for target_link_libraries() and similar commands
+
+include(CheckIncludeFiles)
+include(CheckCSourceCompiles)
+include(PrintableOptions)
+include(PkgConfigEx)
+
+add_printable_option(ENABLE_SMIME "Enable SMIME support through Mozilla nss" ON)
+add_printable_variable_path(WITH_NSPR_INCLUDES "Prefix of Mozilla nspr4 includes" "")
+add_printable_variable_path(WITH_NSPR_LIBS "Prefix of Mozilla nspr4 libs" "")
+add_printable_variable_path(WITH_NSS_INCLUDES "Prefix of Mozilla nss3 includes" "")
+add_printable_variable_path(WITH_NSS_LIBS "Prefix of Mozilla nss3 libs" "")
+
+if(NOT ENABLE_SMIME)
+ return()
+endif(NOT ENABLE_SMIME)
+
+set(mozilla_nspr "")
+set(mozilla_nss "")
+
+# Use pkg-config when none is specified
+if((WITH_NSPR_INCLUDES STREQUAL "") AND (WITH_NSPR_LIBS STREQUAL "") AND (WITH_NSS_INCLUDES STREQUAL "") AND (WITH_NSS_INCLUDES STREQUAL ""))
+ foreach(pkg nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr)
+ pkg_check_exists(_have_pkg ${pkg})
+ if(_have_pkg)
+ set(mozilla_nspr ${pkg})
+ break()
+ endif(_have_pkg)
+ endforeach(pkg)
+
+ foreach(pkg nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss)
+ pkg_check_exists(_have_pkg ${pkg})
+ if(_have_pkg)
+ set(mozilla_nss ${pkg})
+ break()
+ endif(_have_pkg)
+ endforeach(pkg)
+
+ if((NOT (mozilla_nspr STREQUAL "")) AND (NOT (mozilla_nss STREQUAL "")))
+ set(MANUAL_NSPR_INCLUDES "")
+ set(MANUAL_NSPR_LIBS "")
+ set(MANUAL_NSS_INCLUDES "")
+ set(MANUAL_NSS_LIBS "")
+ return()
+ endif((NOT (mozilla_nspr STREQUAL "")) AND (NOT (mozilla_nss STREQUAL "")))
+endif()
+
+# Manual search, even when pkg-config failed
+
+# ******************
+# Check for NSPR 4
+# ******************
+
+if(NOT (WITH_NSPR_INCLUDES STREQUAL ""))
+ set(CMAKE_REQUIRED_INCLUDES ${WITH_NSPR_INCLUDES})
+endif(NOT (WITH_NSPR_INCLUDES STREQUAL ""))
+
+CHECK_INCLUDE_FILES(nspr.h prio.h _have_headers)
+
+unset(CMAKE_REQUIRED_INCLUDES)
+
+if(NOT _have_headers)
+ message(FATAL_ERROR "NSPR headers not found. Use -DWITH_NSPR_INCLUDES=/path/to/nspr to specify the include dir of NSPR.")
+endif(NOT _have_headers)
+
+set(MANUAL_NSPR_INCLUDES "${WITH_NSPR_INCLUDES}")
+
+set(nsprlibs "-lplc4 -lplds4 -lnspr4")
+
+set(CMAKE_REQUIRED_INCLUDES ${MANUAL_NSPR_INCLUDES})
+set(CMAKE_REQUIRED_LIBRARIES ${nsprlibs})
+CHECK_C_SOURCE_COMPILES("#include <prinit.h>
+ int main(void) { PR_Initialized(); return 0; }" _nsprlibs_okay)
+unset(CMAKE_REQUIRED_FLAGS)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
+if(NOT _nsprlibs_okay)
+ message(FATAL_ERROR "NSPR libs not found. Use -DWITH_NSPR_LIBS=/path/to/libs to specify the libdir of NSPR")
+endif(NOT _nsprlibs_okay)
+
+set(MANUAL_NSPR_LIBS "")
+
+if(NOT (WITH_NSPR_LIBS STREQUAL ""))
+ set(MANUAL_NSPR_LIBS "-L${WITH_NSPR_LIBS}")
+endif(NOT (WITH_NSPR_LIBS STREQUAL ""))
+
+set(MANUAL_NSPR_LIBS "${MANUAL_NSPR_LIBS} ${nsprlibs}")
+
+# *****************
+# Check for NSS 3
+# *****************
+
+if(NOT (WITH_NSS_INCLUDES STREQUAL ""))
+ set(CMAKE_REQUIRED_INCLUDES ${WITH_NSS_INCLUDES})
+endif(NOT (WITH_NSS_INCLUDES STREQUAL ""))
+
+CHECK_INCLUDE_FILES(nss.h ssl.h smime.h _have_headers)
+
+unset(CMAKE_REQUIRED_INCLUDES)
+
+if(NOT _have_headers)
+ message(FATAL_ERROR "NSS headers not found. Use -DWITH_NSS_INCLUDES=/path/to/nss to specify the include dir of NSS.")
+endif(NOT _have_headers)
+
+set(MANUAL_NSS_INCLUDES "${WITH_NSS_INCLUDES} ${MANUAL_NSPR_INCLUDES}")
+
+set(nsslibs "-lssl3 -lsmime3 -lnss3")
+
+set(CMAKE_REQUIRED_INCLUDES ${MANUAL_NSS_INCLUDES})
+set(CMAKE_REQUIRED_LIBRARIES ${nsslibs} ${nsprlibs})
+CHECK_C_SOURCE_COMPILES("#include <nss.h>
+ int main(void) { NSS_Init(\"\"); return 0; }" _nsslibs_okay)
+unset(CMAKE_REQUIRED_FLAGS)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
+if(NOT _nsslibs_okay)
+ message(FATAL_ERROR "NSS libs not found. Use -DWITH_NSS_LIBS=/path/to/libs to specify the libdir of NSS")
+endif(NOT _nsslibs_okay)
+
+set(MANUAL_NSS_LIBS "")
+
+if(NOT (WITH_NSS_LIBS STREQUAL ""))
+ set(MANUAL_NSS_LIBS "-L${WITH_NSS_LIBS}")
+endif(NOT (WITH_NSS_LIBS STREQUAL ""))
+
+set(MANUAL_NSS_LIBS "${MANUAL_NSS_LIBS} ${nsslibs} ${MANUAL_NSPR_LIBS}")
diff --git a/cmake/modules/PkgConfigEx.cmake b/cmake/modules/PkgConfigEx.cmake
new file mode 100644
index 000000000..cb352298c
--- /dev/null
+++ b/cmake/modules/PkgConfigEx.cmake
@@ -0,0 +1,46 @@
+# PkgConfigEx.cmake
+#
+# Extends CMake's PkgConfig module with commands:
+#
+# pkg_check_modules_for_option(_option_name _option_description _prefix _module0)
+#
+# which calls `pkg_check_modules(_prefix _module0)` and if <_prefix>_FOUND is False,
+# then prints an error with a hint to disaable the _option_name if needed.
+#
+# pkg_check_exists(_output_name _pkg)
+#
+# calls pkg-config --exists for _pkg and stores the result to _output_name.
+#
+# pkg_check_variable(_output_name _pkg _name)
+#
+# gets a variable named _name from package _pkg and stores the result into _output_name
+
+find_package(PkgConfig REQUIRED)
+
+macro(pkg_check_modules_for_option _option_name _option_description _prefix _module0)
+ pkg_check_modules(${_prefix} ${_module0})
+
+ if(NOT ${_prefix}_FOUND)
+ message(FATAL_ERROR "Necessary libraries not or not enough version. If you want to disable ${_option_description}, please use -D${_option_name}=OFF argument to cmake command.")
+ endif(NOT ${_prefix}_FOUND)
+endmacro()
+
+macro(pkg_check_exists _output_name _pkg)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --exists ${_pkg}
+ RESULT_VARIABLE ${_output_name})
+
+ # Negate the result, because 0 means 'found'
+ if(${_output_name})
+ set(${_output_name} OFF)
+ else(${_output_name})
+ set(${_output_name} ON)
+ endif(${_output_name})
+endmacro()
+
+function(pkg_check_variable _output_name _pkg _name)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg}
+ OUTPUT_VARIABLE _pkg_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable ${_name} of ${_pkg}")
+endfunction()
diff --git a/cmake/modules/PrintableOptions.cmake b/cmake/modules/PrintableOptions.cmake
new file mode 100644
index 000000000..72a1eb839
--- /dev/null
+++ b/cmake/modules/PrintableOptions.cmake
@@ -0,0 +1,74 @@
+# PrintableOptions.cmake
+#
+# Provides functions to manage printable otpions,
+# which can be printed at the end of the configuration
+#
+# add_printable_option(_name _description _default_value)
+# the same as option() commnd, only also notes this option for later printing
+#
+# add_printable_variable(_name _description _default_value)
+# sets a new cached STRING variable and adds it to the list of printable options
+#
+# add_printable_variable_path(_name _description _default_value)
+# sets a new cached PATH variable and adds it to the list of printable options
+#
+# add_printable_variable_custom(_name)
+# adds variable named _name to the list of prinable options
+#
+# print_build_options()
+# prints all the build options previously added with the above functions
+
+macro(add_printable_option _name _description _default_value)
+ if(_name STREQUAL "")
+ message(FATAL_ERROR "option name cannot be empty")
+ endif(_name STREQUAL "")
+ option(${_name} ${_description} ${_default_value})
+ list(APPEND _printable_options ${_name})
+endmacro()
+
+macro(add_printable_variable _name _description _default_value)
+ if(_name STREQUAL "")
+ message(FATAL_ERROR "variable name cannot be empty")
+ endif(_name STREQUAL "")
+ set(${_name} ${_default_value} CACHE STRING ${_description})
+ list(APPEND _printable_options ${_name})
+endmacro()
+
+macro(add_printable_variable_path _name _description _default_value)
+ if(_name STREQUAL "")
+ message(FATAL_ERROR "path variable name cannot be empty")
+ endif(_name STREQUAL "")
+ set(${_name} ${_default_value} CACHE PATH ${_description})
+ list(APPEND _printable_options ${_name})
+endmacro()
+
+macro(add_printable_variable_custom _name)
+ if(_name STREQUAL "")
+ message(FATAL_ERROR "variable name cannot be empty")
+ endif(_name STREQUAL "")
+ list(APPEND _printable_options ${_name})
+endmacro()
+
+function(print_build_options)
+ message(STATUS "Configure options:")
+
+ set(max_len 0)
+ foreach(opt IN LISTS _printable_options)
+ string(LENGTH "${opt}" len)
+ if(max_len LESS len)
+ set(max_len ${len})
+ endif(max_len LESS len)
+ endforeach()
+ math(EXPR max_len "${max_len} + 2")
+
+ foreach(opt IN LISTS _printable_options)
+ string(LENGTH "${opt}" len)
+ set(str " ${opt} ")
+ foreach (IGNORE RANGE ${len} ${max_len})
+ set(str "${str}.")
+ endforeach ()
+ set(str "${str} ${${opt}}")
+
+ message(STATUS ${str})
+ endforeach()
+endfunction()
diff --git a/cmake/modules/SetupCompilerWarningFlags.cmake b/cmake/modules/SetupCompilerWarningFlags.cmake
new file mode 100644
index 000000000..6cd2e3795
--- /dev/null
+++ b/cmake/modules/SetupCompilerWarningFlags.cmake
@@ -0,0 +1,70 @@
+# SetupCompilerWarningFlags.cmake
+#
+# Setups compiler warning flags, skipping those which are not supported.
+
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
+function(setup_compiler_warning_flags _maintainer_mode)
+ list(APPEND proposed_warning_flags
+ -Werror-implicit-function-declaration
+ -Wformat
+ -Wformat-security
+ -Winit-self
+ -Wmissing-declarations
+ -Wmissing-include-dirs
+ -Wmissing-noreturn
+ -Wpointer-arith
+ -Wredundant-decls
+ -Wundef
+ -Wwrite-strings
+ )
+
+ if(_maintainer_mode)
+ list(APPEND proposed_warning_flags
+ -Wall
+ -Wextra
+ -Wdeprecated-declarations
+ )
+ else(_maintainer_mode)
+ list(APPEND proposed_warning_flags -Wno-deprecated-declarations)
+ endif(_maintainer_mode)
+
+ list(APPEND proposed_c_warning_flags
+ ${proposed_warning_flags}
+ -Wdeclaration-after-statement
+ -Wno-missing-field-initializers
+ -Wno-sign-compare
+ -Wno-unused-parameter
+ -Wnested-externs
+ )
+
+ if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+ list(APPEND proposed_c_warning_flags
+ -Wno-parentheses-equality
+ -Wno-format-nonliteral
+ )
+ endif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+
+ list(APPEND proposed_cxx_warning_flags
+ ${proposed_warning_flags}
+ -Wabi
+ -Wnoexcept
+ )
+
+ foreach(flag IN LISTS proposed_c_warning_flags)
+ check_c_compiler_flag(${flag} _flag_supported)
+ if(_flag_supported)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
+ endif(_flag_supported)
+ unset(_flag_supported)
+ endforeach()
+
+ foreach(flag IN LISTS proposed_cxx_warning_flags)
+ check_cxx_compiler_flag(${flag} _flag_supported)
+ if(_flag_supported)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ endif(_flag_supported)
+ unset(_flag_supported)
+ endforeach()
+endfunction()
diff --git a/cmake/modules/UninstallTarget.cmake b/cmake/modules/UninstallTarget.cmake
new file mode 100644
index 000000000..44ca4425e
--- /dev/null
+++ b/cmake/modules/UninstallTarget.cmake
@@ -0,0 +1,11 @@
+# UninstallTarget.cmake
+#
+# Defines a custom target named 'uninstall'
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 000000000..38b4c8e41
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,337 @@
+/* config.h generated by CMake */
+
+/* Name of the package */
+#define PACKAGE "@PROJECT_NAME@"
+
+/* Version number of the project */
+#define VERSION "@PROJECT_VERSION@"
+
+/* API version (Major.Minor) */
+#define API_VERSION "@API_VERSION@"
+
+/* Base version (Major.Minor) */
+#define BASE_VERSION "@BASE_VERSION@"
+
+/* Package name for gettext */
+#define GETTEXT_PACKAGE "@PROJECT_NAME@-@BASE_VERSION@"
+
+/* D-Bus service name for the address book factory */
+#define ADDRESS_BOOK_DBUS_SERVICE_NAME "@ADDRESS_BOOK_DBUS_SERVICE_NAME@"
+
+/* D-Bus service name for the calendar factory */
+#define CALENDAR_DBUS_SERVICE_NAME "@CALENDAR_DBUS_SERVICE_NAME@"
+
+/* D-Bus service name for the source registry */
+#define SOURCES_DBUS_SERVICE_NAME "@SOURCES_DBUS_SERVICE_NAME@"
+
+/* D-Bus service name for the user prompter */
+#define USER_PROMPTER_DBUS_SERVICE_NAME "@USER_PROMPTER_DBUS_SERVICE_NAME@"
+
+/* Configured with enabled maintainer mode */
+#cmakedefine ENABLE_MAINTAINER_MODE 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#cmakedefine HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the `fsync' function. */
+#cmakedefine HAVE_FSYNC 1
+
+/* Define to 1 if you have the `strptime' function. */
+#cmakedefine HAVE_STRPTIME 1
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+#cmakedefine HAVE_NL_LANGINFO 1
+
+/* Define to 1 if you have the gtk+-3.0 package. */
+#cmakedefine HAVE_GTK 1
+
+/* Define to 1 if Google autentication support is enabled. */
+#cmakedefine ENABLE_GOOGLE_AUTH 1
+
+/* Define Google OAuth 2.0 Client ID to use */
+#define GOOGLE_CLIENT_ID "@WITH_GOOGLE_CLIENT_ID@"
+
+/* Define Google OAuth 2.0 Client Secret to use */
+#define GOOGLE_CLIENT_SECRET "@WITH_GOOGLE_CLIENT_SECRET@"
+
+/* Define to 1 if the examples should be built. */
+#cmakedefine BUILD_EXAMPLES 1
+
+/* Define to 1 if you have the goa-1.0 package. */
+#cmakedefine HAVE_GOA 1
+
+/* If backend-per-process is enabled */
+#cmakedefine ENABLE_BACKEND_PER_PROCESS 1
+
+/* Have libdb */
+#cmakedefine HAVE_LIBDB 1
+
+/* libc provides backtrace_symbols function */
+#cmakedefine HAVE_BACKTRACE_SYMBOLS 1
+
+/* have elfutils/libdwfl.h functions */
+#cmakedefine HAVE_ELFUTILS_LIBDWFL 1
+
+/* Have nl_langinfo (CODESET) */
+#cmakedefine HAVE_CODESET 1
+
+/* Have nl_langinfo (_NL_ADDRESS_COUNTRY_AB2) */
+#cmakedefine HAVE__NL_ADDRESS_COUNTRY_AB2 1
+
+/* strftime supports use of l and k */
+#cmakedefine HAVE_LKSTRFTIME 1
+
+/* Define if SMIME should be enabled */
+#cmakedefine ENABLE_SMIME 1
+
+/* Path to a sendmail binary, or equivalent */
+#define SENDMAIL_PATH "@SENDMAIL_PATH@"
+
+/* Directory local mail is delivered to */
+#define SYSTEM_MAIL_DIR "@SYSTEM_MAIL_DIR@"
+
+/* Define if struct tm has a tm_gmtoff member */
+#cmakedefine HAVE_TM_GMTOFF 1
+
+/* Define if libc defines a timezone variable */
+#cmakedefine HAVE_TIMEZONE 1
+
+/* Define if libc defines an altzone variable */
+#cmakedefine HAVE_ALTZONE 1
+
+/* Define to 1 if you have the `gethostbyaddr_r' function. */
+#cmakedefine HAVE_GETHOSTBYADDR_R 1
+
+/* Define to 1 if you have the `gethostbyname_r' function. */
+#cmakedefine HAVE_GETHOSTBYNAME_R 1
+
+/* Enable IPv6 support */
+#cmakedefine ENABLE_IPv6 1
+
+/* Enable getaddrinfo emulation */
+#cmakedefine NEED_ADDRINFO 1
+
+/* Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo */
+#cmakedefine HAVE_AI_ADDRCONFIG 1
+
+/* Have <wspiapi.h> */
+#cmakedefine HAVE_WSPIAPI_H 1
+
+/* Define to use dot locking for mbox files */
+#cmakedefine USE_DOT_LOCKING 1
+
+/* Define to use fcntl locking for mbox files */
+#cmakedefine USE_FCNTL_LOCKING 1
+
+/* Define to use flock locking for mbox files */
+#cmakedefine USE_FLOCK_LOCKING 1
+
+/* Define if mail delivered to the system mail directory is in broken Content-Length format */
+#cmakedefine ENABLE_BROKEN_SPOOL 1
+
+/* Define if you have Krb5 */
+#cmakedefine HAVE_KRB5 1
+
+/* Define if you have MIT Krb5 */
+#cmakedefine HAVE_MIT_KRB5 1
+
+/* Define if you have Heimdal */
+#cmakedefine HAVE_HEIMDAL_KRB5 1
+
+/* Define if you have Sun Kerberosv5 */
+#cmakedefine HAVE_SUN_KRB5 1
+
+/* *************************************************** */
+
+
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Solaris-style ctime_r */
+/* #undef CTIME_R_THREE_ARGS */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Enable phonenumber parsing */
+/* #undef ENABLE_PHONENUMBER */
+
+/* Solaris-style gethostbyaddr_r */
+/* #undef GETHOSTBYADDR_R_SEVEN_ARGS */
+
+/* Solaris-style gethostbyname_r */
+/* #undef GETHOSTBYNAME_R_FIVE_ARGS */
+
+/* Define it once memory returned by libical is free'ed properly */
+#define HANDLE_LIBICAL_MEMORY 1
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#define HAVE_ALLOCA_H 1
+
+/* Have <com_err.h> */
+#define HAVE_COM_ERR_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Have <et/com_err.h> */
+#define HAVE_ET_COM_ERR_H 1
+
+/* Define to 1 if you have the `gnu_get_libc_version' function. */
+#define HAVE_GNU_GET_LIBC_VERSION 1
+
+/* Define to 1 if you have the google-1.0 package. */
+#define HAVE_GOOGLE 1
+
+/* libical provides icaltzutil_set_exact_vtimezones_support function */
+#define HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT 1
+
+/* libical provides ical_set_unknown_token_handling_setting function */
+#define HAVE_ICAL_UNKNOWN_TOKEN_HANDLING 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define if you have LDAP support */
+#define HAVE_LDAP 1
+
+/* Define if compiled with libical 2.0 */
+#define HAVE_LIBICAL_2_0 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <nspr.h> header file. */
+/* #undef HAVE_NSPR_H */
+
+/* Define to 1 if you have the <nss.h> header file. */
+/* #undef HAVE_NSS_H */
+
+/* Define to 1 if you have the <prio.h> header file. */
+/* #undef HAVE_PRIO_H */
+
+/* Define to 1 if you have the regexec function. */
+#define HAVE_REGEXEC 1
+
+/* Define to 1 if you have the <smime.h> header file. */
+/* #undef HAVE_SMIME_H */
+
+/* Define to 1 if you have the <ssl.h> header file. */
+/* #undef HAVE_SSL_H */
+
+/* Define to 1 if you have the `statfs' function. */
+#define HAVE_STATFS 1
+
+/* Define to 1 if you have the `statvfs' function. */
+#define HAVE_STATVFS 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define HAVE_STRTOK_R 1
+
+/* Have <sys/mount.h> */
+#define HAVE_SYS_MOUNT_H 1
+
+/* Have <sys/param.h> */
+#define HAVE_SYS_PARAM_H 1
+
+/* Have <sys/statvfs.h> */
+#define HAVE_SYS_STATVFS_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unicode/ucol.h> header file. */
+/* #undef HAVE_UNICODE_UCOL_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Have libaccounts-glib */
+/* #undef HAVE_UOA */
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 0 if your system does not have the O_LARGEFILE flag */
+/* #undef O_LARGEFILE */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution-Data-Server"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "evolution-data-server"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "evolution-data-server 3.22.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "evolution-data-server"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.22.0"
+
+/* Whether Parse() or ParseAndKeepRawInput() must be used to get the
+ country-code source */
+/* #undef PHONENUMBER_RAW_INPUT_NEEDED */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you use SunLDAP */
+/* #undef SUNLDAP */
+
+/* Version number of package */
+#define VERSION "3.22.0"
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* 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
+/* #undef inline */
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/iconv-detect.c b/iconv-detect.c
index c9c69bce2..bc7d872a1 100644
--- a/iconv-detect.c
+++ b/iconv-detect.c
@@ -17,9 +17,9 @@
* Authors: Jeffrey Stedfast <fejj@ximian.com>
*/
-#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <iconv.h>
enum {
@@ -87,18 +87,50 @@ static CharInfo iso10646_tests[] = {
static int num_iso10646_tests = sizeof (iso10646_tests) / sizeof (CharInfo);
+static int
+test_iconv (void)
+{
+ char *jp = "\x1B\x24\x42\x46\x7C\x4B\x5C\x38\x6C";
+ char *utf8 = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E";
+ char *transbuf = malloc (10), *trans = transbuf;
+ iconv_t cd;
+ size_t jp_len = strlen (jp), utf8_len = 10;
+ size_t utf8_real_len = strlen (utf8);
+
+ cd = iconv_open ("UTF-8", "ISO-2022-JP");
+ if (cd == (iconv_t) -1)
+ return 0;
+
+ if (iconv (cd, &jp, &jp_len, &trans, &utf8_len) == -1 || jp_len != 0) {
+ iconv_close (cd);
+ return 0;
+ }
+ if (memcmp (utf8, transbuf, utf8_real_len) != 0) {
+ iconv_close (cd);
+ return 0;
+ }
+
+ iconv_close (cd);
+
+ return 1;
+}
-int main (int argc, char **argv)
+int
+main (int argc,
+ char **argv)
{
unsigned int iso8859, iso2022, iso10646;
CharInfo *info;
- GIConv cd;
+ iconv_t cd;
FILE *fp;
int i;
+ if (!test_iconv ())
+ return 1;
+
fp = fopen ("iconv-detect.h", "w");
if (fp == NULL)
- exit (255);
+ return 255;
fprintf (fp, "/* This is an auto-generated header, DO NOT EDIT! */\n\n");
@@ -106,8 +138,8 @@ int main (int argc, char **argv)
info = iso8859_tests;
/*printf ("#define DEFAULT_ISO_FORMAT(iso,codepage)\t");*/
for (i = 0; i < num_iso8859_tests; i++) {
- cd = g_iconv_open (info[i].charset, "UTF-8");
- if (cd != (GIConv) -1) {
+ cd = iconv_open (info[i].charset, "UTF-8");
+ if (cd != (iconv_t) -1) {
iconv_close (cd);
/*printf ("(\"%s\", (iso), (codepage))\n", info[i].format);*/
fprintf (stderr, "System prefers %s\n", info[i].charset);
@@ -119,9 +151,6 @@ int main (int argc, char **argv)
if (iso8859 == ISO_UNSUPPORTED) {
fprintf (stderr, "System doesn't support any ISO-8859-1 formats\n");
fprintf (fp, "#define ICONV_ISO_D_FORMAT \"%s\"\n", info[0].format);
-#ifdef CONFIGURE_IN
- exit (1);
-#endif
} else {
fprintf (fp, "#define ICONV_ISO_D_FORMAT \"%s\"\n", info[i].format);
}
@@ -131,8 +160,8 @@ int main (int argc, char **argv)
/*printf ("#define ISO_2022_FORMAT(iso,codepage)\t");*/
for (i = 0; i < num_iso2022_tests; i++) {
cd = iconv_open (info[i].charset, "UTF-8");
- if (cd != (GIConv) -1) {
- g_iconv_close (cd);
+ if (cd != (iconv_t) -1) {
+ iconv_close (cd);
/*printf ("(\"%s\", (iso), (codepage))\n", info[i].format);*/
fprintf (stderr, "System prefers %s\n", info[i].charset);
iso2022 = info[i].id;
@@ -143,9 +172,6 @@ int main (int argc, char **argv)
if (iso2022 == ISO_UNSUPPORTED) {
fprintf (stderr, "System doesn't support any ISO-2022 formats\n");
fprintf (fp, "#define ICONV_ISO_S_FORMAT \"%s\"\n", info[0].format);
-#ifdef CONFIGURE_IN
- exit (3);
-#endif
} else {
fprintf (fp, "#define ICONV_ISO_S_FORMAT \"%s\"\n", info[i].format);
}
@@ -155,8 +181,8 @@ int main (int argc, char **argv)
/*printf ("#define ISO_10646_FORMAT(iso,codepage)\t");*/
for (i = 0; i < num_iso10646_tests; i++) {
cd = iconv_open (info[i].charset, "UTF-8");
- if (cd != (GIConv) -1) {
- g_iconv_close (cd);
+ if (cd != (iconv_t) -1) {
+ iconv_close (cd);
/*if (info[i].id < ISO_DASH_D_LOWER)
printf ("(\"%s\", (iso), (codepage))\n", info[i].format);
else
@@ -171,14 +197,11 @@ int main (int argc, char **argv)
if (iso10646 == ISO_UNSUPPORTED) {
fprintf (stderr, "System doesn't support any ISO-10646-1 formats\n");
fprintf (fp, "#define ICONV_10646 \"%s\"\n", info[0].charset);
-#ifdef CONFIGURE_IN
- exit (2);
-#endif
} else {
fprintf (fp, "#define ICONV_10646 \"%s\"\n", info[i].charset);
}
fclose (fp);
- exit (0);
+ return 0;
}