Skip to content

Commit 7cd0a69

Browse files
committed
build: test for __declspec(dllexport) in configure
This should work for GCC and Clang when building for Windows targets.
1 parent 1624e17 commit 7cd0a69

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

configure.ac

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ if test x$ac_cv_sys_large_files != x &&
813813
CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
814814
fi
815815

816-
AX_GCC_FUNC_ATTRIBUTE([dllexport])
817816
AX_GCC_FUNC_ATTRIBUTE([dllimport])
818817

819818
if test x$use_glibc_compat != xno; then
@@ -1000,6 +999,18 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1000999
]
10011000
)
10021001

1002+
AC_MSG_CHECKING([for dllexport attribute])
1003+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1004+
__declspec(dllexport) int foo(void);
1005+
int main(){}
1006+
])],
1007+
[
1008+
AC_DEFINE(HAVE_DLLEXPORT_ATTRIBUTE,1,[Define if the dllexport attribute is supported.])
1009+
AC_MSG_RESULT(yes)
1010+
],
1011+
[AC_MSG_RESULT(no)]
1012+
)
1013+
10031014
dnl thread_local is currently disabled when building with glibc back compat.
10041015
dnl Our minimum supported glibc is 2.17, however support for thread_local
10051016
dnl did not arrive in glibc until 2.18.

src/script/bitcoinconsensus.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
1212
#include <config/bitcoin-config.h>
1313
#if defined(_WIN32)
14-
#if defined(DLL_EXPORT)
15-
#if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT)
16-
#define EXPORT_SYMBOL __declspec(dllexport)
17-
#else
18-
#define EXPORT_SYMBOL
19-
#endif
14+
#if defined(HAVE_DLLEXPORT_ATTRIBUTE)
15+
#define EXPORT_SYMBOL __declspec(dllexport)
16+
#else
17+
#define EXPORT_SYMBOL
2018
#endif
2119
#elif defined(HAVE_DEFAULT_VISIBILITY_ATTRIBUTE)
2220
#define EXPORT_SYMBOL __attribute__ ((visibility ("default")))

0 commit comments

Comments
 (0)