From 0df51dc9e4b8596adb00f912854f5061941c9a59 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 18 Aug 2013 12:13:48 -0700 Subject: [PATCH] Add explicit checking for OpenSSL multithreading support --- .../Builds/VisualStudio2012/beast.vcxproj | 1 + .../VisualStudio2012/beast.vcxproj.filters | 9 +++-- .../beast/modules/beast_asio/beast_asio.cpp | 2 + .../beast_asio/system/beast_OpenSSLIncludes.h | 40 +++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 Subtrees/beast/modules/beast_asio/system/beast_OpenSSLIncludes.h diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj index 2c773805a..0df23244e 100644 --- a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj +++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj @@ -86,6 +86,7 @@ + diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters index 601d42096..440982c12 100644 --- a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters +++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters @@ -845,15 +845,18 @@ beast_asio\handshake - - beast_asio\handshake - beast_asio\basics beast_core\memory + + beast_asio\sockets + + + beast_asio\system + diff --git a/Subtrees/beast/modules/beast_asio/beast_asio.cpp b/Subtrees/beast/modules/beast_asio/beast_asio.cpp index ef34ceb84..a4b780995 100644 --- a/Subtrees/beast/modules/beast_asio/beast_asio.cpp +++ b/Subtrees/beast/modules/beast_asio/beast_asio.cpp @@ -19,6 +19,8 @@ #include "BeastConfig.h" +#include "system/beast_OpenSSLIncludes.h" + #include "beast_asio.h" namespace beast diff --git a/Subtrees/beast/modules/beast_asio/system/beast_OpenSSLIncludes.h b/Subtrees/beast/modules/beast_asio/system/beast_OpenSSLIncludes.h new file mode 100644 index 000000000..92133891c --- /dev/null +++ b/Subtrees/beast/modules/beast_asio/system/beast_OpenSSLIncludes.h @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +/* + This file is part of Beast: https://github.com/vinniefalco/Beast + Copyright 2013, Vinnie Falco + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#ifndef BEAST_OPENSSLINCLUDES_H_INCLUDED +#define BEAST_OPENSSLINCLUDES_H_INCLUDED + +#define OPENSSL_THREAD_DEFINES +#include + +//------------------------------------------------------------------------------ + +// Configure our settings based on what we find +// +#if defined(OPENSSL_THREADS) +# ifndef BEAST_OPENSSL_MULTITHREADED +# define BEAST_OPENSSL_MULTITHREADED 1 +# endif +#else +# ifndef BEAST_OPENSSL_MULTITHREADED +# define BEAST_OPENSSL_MULTITHREADED 0 +# endif +#endif + +#endif