forked from wolfSSL/wolfssl
static and shared library with MinGW
This commit is contained in:
43
configure.ac
43
configure.ac
@ -2624,19 +2624,17 @@ AX_HARDEN_CC_COMPILER_FLAGS
|
||||
# if mingw then link to ws2_32 for sockets
|
||||
case $host_os in
|
||||
mingw*)
|
||||
LDFLAGS="$LDFLAGS -lws2_32" ;;
|
||||
LDFLAGS="$LDFLAGS -lws2_32"
|
||||
if test "$enable_shared" = "yes"
|
||||
then
|
||||
AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
|
||||
if test "$enable_static" = "yes"
|
||||
then
|
||||
MINGW_LIB_WARNING="yes"
|
||||
fi
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
# add wolfSSL defines for shared/static
|
||||
if test "$enable_shared" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHARED"
|
||||
fi
|
||||
if test "$enable_static" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC"
|
||||
fi
|
||||
|
||||
# add user C_EXTRA_FLAGS back
|
||||
CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
|
||||
OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $AM_CFLAGS"
|
||||
@ -2879,8 +2877,31 @@ echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
|
||||
echo ""
|
||||
echo "---"
|
||||
|
||||
################################################################################
|
||||
# Show warnings at bottom so they are noticed
|
||||
################################################################################
|
||||
|
||||
if test "$ENABLED_ASYNCCRYPT" = "yes"
|
||||
then
|
||||
AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
|
||||
fi
|
||||
|
||||
# MinGW static vs shared library
|
||||
# The URL I was looking at for this was
|
||||
# http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
|
||||
# this allows for not even having dllimport/dllexport on functions
|
||||
# with recent libtools, only requiring it with global variables.
|
||||
# The warning is displayed here because if not using "contemporary GNU
|
||||
# tools" there is the possibility of export/import issues.
|
||||
# We use __declspec(dllexport) and "contemporary GNU tools" are taking care
|
||||
# of the case where both static and shared libraries are built. It is also
|
||||
# placing both __imp__function and function in the lib.dll.a created. Allowing
|
||||
# users to choose if they use __declspec(dllimport) with defining WOLFSSL_DLL.
|
||||
#
|
||||
# More can be found about the MinGW linker at
|
||||
# https://sourceware.org/binutils/docs/ld/WIN32.html
|
||||
if test "$MINGW_LIB_WARNING" = "yes"
|
||||
then
|
||||
AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.])
|
||||
fi
|
||||
|
||||
|
@ -46,9 +46,8 @@
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define WOLFSSL_API __global
|
||||
#define WOLFSSL_LOCAL __hidden
|
||||
#elif defined(_MSC_VER)
|
||||
#if defined(WOLFSSL_DLL) || \
|
||||
(defined(__MINGW32__) && defined(WOLFSSL_SHARED))
|
||||
#elif defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#if defined(WOLFSSL_DLL)
|
||||
#define WOLFSSL_API __declspec(dllexport)
|
||||
#else
|
||||
#define WOLFSSL_API
|
||||
@ -59,9 +58,8 @@
|
||||
#define WOLFSSL_LOCAL
|
||||
#endif /* HAVE_VISIBILITY */
|
||||
#else /* BUILDING_WOLFSSL */
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(WOLFSSL_DLL) || \
|
||||
(defined(__MINGW32__) && defined(WOLFSSL_SHARED))
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#if defined(WOLFSSL_DLL)
|
||||
#define WOLFSSL_API __declspec(dllimport)
|
||||
#else
|
||||
#define WOLFSSL_API
|
||||
|
Reference in New Issue
Block a user