aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-08-05 20:34:43 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-08-05 20:34:43 +0000
commit0eb2ee14350308042eae163af35e795d6a67f8d3 (patch)
tree1fd4fa815d3fcbdb961d2360a9216771c22c7ce7
parentWorkaround for MinGW autoconf issue where HAVE_SETSOCKOPT, (diff)
downloadopenvpn-0eb2ee14350308042eae163af35e795d6a67f8d3.tar.xz
Reverted r3181, accomplish the same thing via a special case
for Windows stdcall functions in configure.ac (Alon Bar-Lev). Minor fix to cryptoapi.c to not compile itself unless USE_CRYPTO and USE_SSL flags are enabled (Alon Bar-Lev). git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3183 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r--configure.ac23
-rw-r--r--cryptoapi.c2
-rw-r--r--syshead.h12
3 files changed, 16 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index da53407..bd256b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,17 +458,25 @@ AC_CHECK_SIZEOF(unsigned long)
AC_CACHE_SAVE
+AC_CHECK_FUNCS([ctime memset vsnprintf strdup], ,
+ [AC_MSG_ERROR([Required library function not found])])
AC_CHECK_FUNCS(daemon chroot getpwnam setuid nice system getpid dup dup2 dnl
getpass strerror syslog openlog mlockall getgrnam setgid dnl
- setgroups stat flock readv writev setsockopt getsockopt dnl
+ setgroups stat flock readv writev time dnl
setsid chdir putenv getpeername unlink dnl
- poll chsize ftruncate sendmsg recvmsg getsockname dnl
- execve)
-AC_CACHE_SAVE
+ chsize ftruncate execve)
+
+# Windows use stdcall for winsock so we cannot auto detect these
+m4_define([SOCKET_FUNCS], [socket recv recvfrom send sendto listen dnl
+ accept connect bind select gethostbyname inet_ntoa])
+m4_define([SOCKET_OPT_FUNCS], [setsockopt getsockopt getsockname poll])
if test "${WIN32}" = "yes"; then
AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [We fake gettimeofday for win32 at otime.c])
+ m4_foreach([F], m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
+ m4_define(UF, [[m4_join([_], [HAVE], m4_toupper(F))]])
+ AC_DEFINE([UF], [1], [Win32 builtin]))
else
@@ -489,10 +497,9 @@ else
AC_CHECK_FUNCS(gettimeofday)
- AC_CHECK_FUNCS(socket recv recvfrom send sendto listen dnl
- accept connect bind select gethostbyname dnl
- inet_ntoa time ctime memset vsnprintf strdup, [],
- [AC_MSG_ERROR([Required library function not found])])
+ AC_CHECK_FUNCS(SOCKET_FUNCS, ,
+ [AC_MSG_ERROR([Required library function not found])])
+ AC_CHECK_FUNCS(SOCKET_OPT_FUNCS sendmsg recvmsg)
fi
diff --git a/cryptoapi.c b/cryptoapi.c
index 3b78e2b..9406c7a 100644
--- a/cryptoapi.c
+++ b/cryptoapi.c
@@ -30,7 +30,7 @@
#include "syshead.h"
-#ifdef WIN32
+#if defined(WIN32) && defined(USE_CRYPTO) && defined(USE_SSL)
#include <openssl/ssl.h>
#include <openssl/err.h>
diff --git a/syshead.h b/syshead.h
index 358c0bc..e87814e 100644
--- a/syshead.h
+++ b/syshead.h
@@ -54,18 +54,6 @@
#define sleep(x) Sleep((x)*1000)
#define random rand
#define srandom srand
-
-/* MinGW autoconf workaround */
-
-#undef HAVE_SETSOCKOPT
-#define HAVE_SETSOCKOPT 1
-
-#undef HAVE_GETSOCKOPT
-#define HAVE_GETSOCKOPT 1
-
-#undef HAVE_POLL
-#define HAVE_POLL 1
-
#endif
#ifdef HAVE_SYS_TYPES_H