summaryrefslogtreecommitdiff
path: root/config.h.cmake
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2015-05-02 08:15:39 -0400
committerAllen Winter <allen.winter@kdab.com>2015-05-02 08:15:39 -0400
commit092c2f83891e7c3bd3a9a7b0b23add92d9af90d2 (patch)
treeb9dd725510201a6a538101c1195a9f22f4453f8a /config.h.cmake
parentb9e3d247bc5f241190a4ee150f725728531c4255 (diff)
downloadlibical-git-092c2f83891e7c3bd3a9a7b0b23add92d9af90d2.tar.gz
WIP: porting to Windows with MSVC 2012
Diffstat (limited to 'config.h.cmake')
-rw-r--r--config.h.cmake33
1 files changed, 29 insertions, 4 deletions
diff --git a/config.h.cmake b/config.h.cmake
index aa00e006..2bd97c11 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -84,6 +84,12 @@
/* Define to 1 if you have the `_access' function. */
#cmakedefine HAVE__ACCESS 1
+/* Define to 1 if you have the `getpid' function. */
+#cmakedefine HAVE_GETPID 1
+
+/* Define to 1 if you have the `_getpid' function. */
+#cmakedefine HAVE__GETPID 1
+
/* Define to 1 if you have the `mkdir' function. */
#cmakedefine HAVE_MKDIR 1
@@ -270,7 +276,7 @@ typedef int pid_t;
#endif
#endif
-/* access - function to check user file permissions */
+/* access - system function to check user file permissions */
#if defined(HAVE__ACCESS)
#include <io.h>
#define access _access
@@ -284,6 +290,20 @@ typedef int pid_t;
#endif
#endif
+/* getpid - system function to get process identification */
+#if defined(HAVE__GETPID)
+#include <process.h>
+#define getpid _getpid
+#else
+#if !defined(HAVE_GETPID)
+#error "No get process identification function available"
+#else
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#endif
+#endif
+
/* mkdir - system function to create a directory */
#if defined(HAVE__MKDIR)
#include <direct.h>
@@ -304,11 +324,10 @@ typedef int pid_t;
#else
#if !defined(HAVE_OPEN)
#error "No open file system function available"
-#else
-#if defined(HAVE_FCNTL_H)
-#include <fcntl.h>
#endif
#endif
+#if defined(HAVE_FCNTL_H)
+#include <fcntl.h>
#endif
#if defined(_MSC_VER)
@@ -326,6 +345,12 @@ typedef int pid_t;
#endif
#endif
+#if defined(_MSC_VER)
+#define _S_ISTYPE(mode, mask) (((mode) & _S_IFMT) == (mask))
+#define S_ISDIR(mode) _S_ISTYPE((mode), _S_IFDIR)
+#define S_ISREG(mode) _S_ISTYPE((mode), _S_IFREG)
+#endif
+
/* fork - system function to create a child process */
#if defined(HAVE_FORK)
#if defined(HAVE_UNISTD_H)