diff options
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | cryptoapi.c | 2 | ||||
-rw-r--r-- | syshead.h | 12 |
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> @@ -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 |