Browse code

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

james authored on 2008/08/06 05:34:43
Showing 3 changed files
... ...
@@ -458,17 +458,25 @@ AC_CHECK_SIZEOF(unsigned long)
458 458
 
459 459
 AC_CACHE_SAVE
460 460
 
461
+AC_CHECK_FUNCS([ctime memset vsnprintf strdup], ,
462
+               [AC_MSG_ERROR([Required library function not found])])
461 463
 AC_CHECK_FUNCS(daemon chroot getpwnam setuid nice system getpid dup dup2 dnl
462 464
 	       getpass strerror syslog openlog mlockall getgrnam setgid dnl
463
-	       setgroups stat flock readv writev setsockopt getsockopt dnl
465
+	       setgroups stat flock readv writev time dnl
464 466
 	       setsid chdir putenv getpeername unlink dnl
465
-	       poll chsize ftruncate sendmsg recvmsg getsockname dnl
466
-	       execve)
467
-AC_CACHE_SAVE
467
+	       chsize ftruncate execve)
468
+
469
+# Windows use stdcall for winsock so we cannot auto detect these
470
+m4_define([SOCKET_FUNCS], [socket recv recvfrom send sendto listen dnl
471
+          accept connect bind select gethostbyname inet_ntoa])
472
+m4_define([SOCKET_OPT_FUNCS], [setsockopt getsockopt getsockname poll])
468 473
 
469 474
 if test "${WIN32}" = "yes"; then
470 475
 
471 476
 	AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [We fake gettimeofday for win32 at otime.c])
477
+	m4_foreach([F], m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
478
+		m4_define(UF, [[m4_join([_], [HAVE], m4_toupper(F))]])
479
+		AC_DEFINE([UF], [1], [Win32 builtin]))
472 480
 
473 481
 else
474 482
 
... ...
@@ -489,10 +497,9 @@ else
489 489
 
490 490
 	AC_CHECK_FUNCS(gettimeofday)
491 491
 
492
-	AC_CHECK_FUNCS(socket recv recvfrom send sendto listen dnl
493
-		       accept connect bind select gethostbyname dnl
494
-		       inet_ntoa time ctime memset vsnprintf strdup, [],
495
-		       [AC_MSG_ERROR([Required library function not found])])
492
+	AC_CHECK_FUNCS(SOCKET_FUNCS, ,
493
+	       [AC_MSG_ERROR([Required library function not found])])
494
+	AC_CHECK_FUNCS(SOCKET_OPT_FUNCS sendmsg recvmsg)
496 495
 
497 496
 fi
498 497
 
... ...
@@ -30,7 +30,7 @@
30 30
 
31 31
 #include "syshead.h"
32 32
 
33
-#ifdef WIN32
33
+#if defined(WIN32) && defined(USE_CRYPTO) && defined(USE_SSL)
34 34
 
35 35
 #include <openssl/ssl.h>
36 36
 #include <openssl/err.h>
... ...
@@ -54,18 +54,6 @@
54 54
 #define sleep(x) Sleep((x)*1000)
55 55
 #define random rand
56 56
 #define srandom srand
57
-
58
-/* MinGW autoconf workaround */
59
-
60
-#undef HAVE_SETSOCKOPT
61
-#define HAVE_SETSOCKOPT 1
62
-
63
-#undef HAVE_GETSOCKOPT
64
-#define HAVE_GETSOCKOPT 1
65
-
66
-#undef HAVE_POLL
67
-#define HAVE_POLL 1
68
-
69 57
 #endif
70 58
 
71 59
 #ifdef HAVE_SYS_TYPES_H