summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--ConfigureChecks.cmake61
-rw-r--r--Install.txt4
-rw-r--r--config.h.cmake36
-rw-r--r--src/libical/icallangbind.c9
-rw-r--r--src/libicalss/icalfileset.c2
-rw-r--r--src/test/timezones.c2
7 files changed, 73 insertions, 61 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d892d01..446bf0f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,13 +48,13 @@
# Default=false (use the default size of time_t)
#
-cmake_minimum_required(VERSION 2.8.9)
-
+cmake_minimum_required(VERSION 2.8.9) #first line, to shutup a cygwin warning
project(libical C CXX)
-if(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
- cmake_policy(SET CMP0005 OLD)
+cmake_policy(SET CMP0003 NEW)
+cmake_policy(SET CMP0005 OLD)
+if(POLICY CMP0054)
+ cmake_policy(SET CMP0054 NEW)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
@@ -274,6 +274,16 @@ endif()
if(SIZEOF_TIME_T EQUAL 4)
set(USE_32BIT_TIME_T TRUE)
endif()
+if(WIN32 AND MSVC)
+ if(SIZEOF_SIZE_T LESS SIZEOF_TIME_T)
+ unset(SIZEOF_SIZE_T CACHE)
+ unset(SIZEOF_TIME_T CACHE)
+ message(FATAL_ERROR
+ "You are using a Microsoft Visual 32-bit compiler with 64-bit time."
+ "Run cmake again with the \"-DUSE_32BIT_TIME_T=true\" command line option."
+ )
+ endif()
+endif()
################# build subdirs ########################
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 24b4ab76..18397475 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -14,38 +14,41 @@ check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(wctype.h HAVE_WCTYPE_H)
include(CheckFunctionExists)
-check_function_exists(access HAVE_ACCESS) #Unix <unistd.h>
-check_function_exists(_access HAVE__ACCESS) #Windows <io.h>
+if(WIN32 AND MSVC)
+ check_function_exists(_access HAVE__ACCESS) #Windows <io.h>
+ check_function_exists(_getpid HAVE__GETPID) #Windows <process.h>
+ check_function_exists(_mkdir HAVE__MKDIR) #Windows <direct.h>
+ check_function_exists(_open HAVE__OPEN) #Windows <io.h>
+ check_function_exists(_snprintf HAVE__SNPRINTF) #Windows <stdio.h>
+ check_function_exists(_stat HAVE__STAT) #Windows <sys/types.h>,<sys/stat.h>
+ check_function_exists(_strdup HAVE__STRDUP) #Windows <string.h>
+ check_function_exists(_stricmp HAVE__STRICMP) #Windows <string.h>
+ check_function_exists(_strnicmp HAVE__STRNICMP) #Windows <string.h>
+ check_function_exists(_read HAVE__READ) #Windows <io.h>
+ check_function_exists(_write HAVE__WRITE) #Windows <io.h>
+else()
+ check_function_exists(access HAVE_ACCESS) #Unix <unistd.h>
+ check_function_exists(fork HAVE_FORK) #Unix <unistd.h>
+ check_function_exists(getpid HAVE_GETPID) #Unix <unistd.h>
+ check_function_exists(getpwent HAVE_GETPWENT) #Unix <sys/types.h>,<pwd.h>
+ check_function_exists(gmtime_r HAVE_GMTIME_R) #Unix <time.h>
+ check_function_exists(mkdir HAVE_MKDIR) #Unix <sys/stat.h>,<sys/types.h>
+ check_function_exists(open HAVE_OPEN) #Unix <sys/stat.h>,<sys/types.h>,<fcntl.h>
+ check_function_exists(snprintf HAVE_SNPRINTF) #Unix <stdio.h>
+ check_function_exists(stat HAVE_STAT) #Unix <sys/stat.h>,<sys/types.h>,<unistd.h>
+ check_function_exists(strdup HAVE_STRDUP) #Unix <string.h>
+ check_function_exists(strcasecmp HAVE_STRCASECMP) #Unix <strings.h>
+ check_function_exists(strncasecmp HAVE_STRNCASECMP) #Unix <strings.h>
+ check_function_exists(read HAVE_READ) #Unix <unistd.h>
+ check_function_exists(unlink HAVE_UNLINK) #Unix <unistd.h>
+ check_function_exists(waitpid HAVE_WAITPID) #Unix <sys/types.h>,<sys/wait.h>
+ check_function_exists(write HAVE_WRITE) #Unix <unistd.h>
+endif()
+
check_function_exists(backtrace HAVE_BACKTRACE)
-check_function_exists(fork HAVE_FORK)
-check_function_exists(getpid HAVE_GETPID) #Unix <unistd.h>
-check_function_exists(_getpid HAVE__GETPID) #Windows <process.h>
-check_function_exists(getpwent HAVE_GETPWENT)
-check_function_exists(gmtime_r HAVE_GMTIME_R)
-check_function_exists(isspace HAVE_ISSPACE)
-check_function_exists(iswspace HAVE_ISWSPACE)
-check_function_exists(mkdir HAVE_MKDIR)
-check_function_exists(_mkdir HAVE__MKDIR) #Windows <io.h>
-check_function_exists(open HAVE_OPEN) #Unix <fcntl.h>
-check_function_exists(_open HAVE__OPEN) #Windows <io.h>
+check_function_exists(iswspace HAVE_ISWSPACE) #Linux <wctype.h>
check_function_exists(setenv HAVE_SETENV)
-check_function_exists(snprintf HAVE_SNPRINTF) #Unix <stdio.h>
-check_function_exists(_snprintf HAVE__SNPRINTF) #Windows <stdio.h>
-check_function_exists(stat HAVE_STAT)
-check_function_exists(_stat HAVE__STAT)
-check_function_exists(strcasecmp HAVE_STRCASECMP)
-check_function_exists(strncasecmp HAVE_STRNCASECMP)
-check_function_exists(stricmp HAVE_STRICMP)
-check_function_exists(strnicmp HAVE_STRNICMP)
-check_function_exists(strdup HAVE_STRDUP) #Unix <string.h>
-check_function_exists(_strdup HAVE__STRDUP) #Windows <string.h>
-check_function_exists(read HAVE_READ) #Unix <unistd.h>
-check_function_exists(_read HAVE__READ) #Windows <io.h>
-check_function_exists(write HAVE_WRITE) #Unix <unistd.h>
-check_function_exists(_write HAVE__WRITE) #Windows <io.h>
check_function_exists(unsetenv HAVE_UNSETENV)
-check_function_exists(unlink HAVE_UNLINK)
-check_function_exists(waitpid HAVE_WAITPID)
include(CheckTypeSize)
check_type_size(size_t SIZEOF_SIZE_T)
diff --git a/Install.txt b/Install.txt
index f18728e8..ad2730c8 100644
--- a/Install.txt
+++ b/Install.txt
@@ -30,6 +30,10 @@ Building on Windows with MicroSoft Visual Studio:
% nmake
% nmake install
+NOTE: Some MSVC 32bit compilers (like MSVC2005) use a 64bit version of time_t.
+In these cases you must pass -DUSE_32BIT_TIME_T=true to cmake to make sure
+the 32bit version of time_t is used instead.
+
Building on Windows with mingw:
% mkdir build
% cd build
diff --git a/config.h.cmake b/config.h.cmake
index e1983c05..04dc00f7 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -24,9 +24,6 @@
/* Define to 1 if you have type 'intptr_t' defined. */
#cmakedefine HAVE_INTPTR_T 1
-/* Define to 1 if you have the `isspace' function. */
-#cmakedefine HAVE_ISSPACE 1
-
/* Define to 1 if you have the `iswspace' function. */
#cmakedefine HAVE_ISWSPACE 1
@@ -66,11 +63,11 @@
/* Define to 1 if you have the `strncasecmp' function. */
#cmakedefine HAVE_STRNCASECMP 1
-/* Define to 1 if you have the `stricmp' function. */
-#cmakedefine HAVE_STRICMP 1
+/* Define to 1 if you have the `_stricmp' function. */
+#cmakedefine HAVE__STRICMP 1
-/* Define to 1 if you have the `strnicmp' function. */
-#cmakedefine HAVE_STRNICMP 1
+/* Define to 1 if you have the `_strnicmp' function. */
+#cmakedefine HAVE__STRNICMP 1
/* Define to 1 if you have the `strdup' function. */
#cmakedefine HAVE_STRDUP 1
@@ -225,27 +222,29 @@ typedef int pid_t;
#include <pwd.h>
#endif
-/* strcasecmp: String compare, case independent */
-#if !defined(HAVE_STRCASECMP)
-#if defined(HAVE_STRICMP)
-#define strcasecmp stricmp
+/* strcasecmp or stricmp: String compare, case independent */
+#if defined(HAVE__STRICMP)
+#define strcasecmp _stricmp
+#include <string.h>
#else
+#if !defined(HAVE_STRCASECMP)
#error "No case independent string compare function available"
-#endif
#else
#include <strings.h>
#endif
+#endif
-/* strncasecmp: String compare, case independent, size limited */
-#if !defined(HAVE_STRNCASECMP)
-#if defined(HAVE_STRNICMP)
-#define strncasecmp strnicmp
+/* strncasecmp or strnicmp: String compare, case independent, size limited */
+#if defined(HAVE__STRICMP)
+#define strncasecmp _strnicmp
+#include <string.h>
#else
+#if !defined(HAVE_STRNCASECMP)
#error "No case independent string compare size limited function available"
-#endif
#else
#include <strings.h>
#endif
+#endif
/* snprintf: size limited sprintf */
#if defined(HAVE__SNPRINTF)
@@ -326,6 +325,9 @@ typedef int pid_t;
#else
#include <sys/types.h>
#include <sys/stat.h>
+#if defined(__MINGW32__) || defined(__MINGW64__)
+#define mkdir(path, mode) mkdir(path)
+#endif
#endif
#endif
diff --git a/src/libical/icallangbind.c b/src/libical/icallangbind.c
index 3f40205b..6c56b2d7 100644
--- a/src/libical/icallangbind.c
+++ b/src/libical/icallangbind.c
@@ -23,17 +23,12 @@
#endif
#include "icalcomponent.h"
-#include "icalproperty.h"
#include "icalerror.h"
#include "icalmemory.h"
+#include "icalproperty.h"
#include "icalvalue.h"
-#include <stdlib.h>
-#include <string.h>
-#if defined(_MSC_VER)
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
+#include <stdlib.h>
int* icallangbind_new_array(int size){
int* p = (int*)malloc(size*sizeof(int));
diff --git a/src/libicalss/icalfileset.c b/src/libicalss/icalfileset.c
index d3a4714d..048ad741 100644
--- a/src/libicalss/icalfileset.c
+++ b/src/libicalss/icalfileset.c
@@ -99,9 +99,7 @@ icalset *icalfileset_init(icalset *set, const char *path, void *options_in)
return 0;
}
-#if !defined(_WIN32)
icalfileset_lock(fset);
-#endif
if (cluster_file_size > 0) {
icalerrorenum error;
diff --git a/src/test/timezones.c b/src/test/timezones.c
index 7c4d96d4..689a448c 100644
--- a/src/test/timezones.c
+++ b/src/test/timezones.c
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
if (total_failed || total_okay) {
percent_failed = total_failed * 100 / (total_failed + total_okay);
- printf(" *** Summary: %lu zones tested, %u days failed, %u okay => %u%% failed ***\n",
+ printf(" *** Summary: %zu zones tested, %u days failed, %u okay => %u%% failed ***\n",
timezones->num_elements,
total_failed,
total_okay,