Borland C++ 5.5 does not use underscored symbols for stat & friends:
--- crypto/rand/randfile.c.orig Sat Jun 12 14:18:55 2010
+++ crypto/rand/randfile.c Tue Jan 11 15:48:11 2011
@@ -81,7 +81,7 @@
# include <sys/stat.h>
#endif
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
#define stat _stat
#define chmod _chmod
#define open _open
--- crypto/x509/by_dir.c.orig Fri Feb 19 19:25:39 2010
+++ crypto/x509/by_dir.c Tue Jan 11 16:10:40 2011
@@ -74,7 +74,7 @@
#include <openssl/lhash.h>
#include <openssl/x509.h>
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
#define stat _stat
#endif
same goes for getpid on 1.0.0:
--- engines/e_aep.c.orig Thu Nov 18 23:59:42 2010
+++ engines/e_aep.c Tue Jan 11 13:22:47 2011
@@ -68,7 +68,7 @@
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
#define getpid GetThreadID
extern int GetThreadID(void);
-#elif defined(_WIN32) && !defined(__WATCOMC__)
+#elif defined(_WIN32) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
#define getpid _getpid
#endif
and for 0.9.8 we should also backport #2375:
--- engines/e_aep.c.orig Tue Dec 30 14:30:57 2008
+++ engines/e_aep.c Tue Jan 11 16:15:45 2011
@@ -68,6 +68,8 @@
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
#define getpid GetThreadID
extern int GetThreadID(void);
+#elif defined(_WIN32) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
+#define getpid _getpid
#endif
#include <openssl/crypto.h>
@@ -867,13 +869,7 @@
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
-#ifdef NETWARE_CLIB
- curr_pid = GetThreadID();
-#elif defined(_WIN32)
- curr_pid = _getpid();
-#else
curr_pid = getpid();
-#endif
/*Check if this is the first time this is being called from the
current
process*/
--- engines/e_aep.c.orig Thu Nov 18 23:59:42 2010
+++ engines/e_aep.c Tue Jan 11 13:22:47 2011
@@ -68,7 +68,7 @@
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
#define getpid GetThreadID
extern int GetThreadID(void);
-#elif defined(_WIN32) && !defined(__WATCOMC__)
+#elif defined(_WIN32) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
#define getpid _getpid
#endif
--- engines/e_aep.c.orig Tue Dec 30 14:30:57 2008
+++ engines/e_aep.c Tue Jan 11 16:15:45 2011
@@ -68,6 +68,8 @@
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
#define getpid GetThreadID
extern int GetThreadID(void);
+#elif defined(_WIN32) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
+#define getpid _getpid
#endif
#include <openssl/crypto.h>
@@ -867,13 +869,7 @@
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
-#ifdef NETWARE_CLIB
- curr_pid = GetThreadID();
-#elif defined(_WIN32)
- curr_pid = _getpid();
-#else
curr_pid = getpid();
-#endif
/*Check if this is the first time this is being called from the current
process*/