diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f2d5d86..522fcb3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1828,3 +1828,9 @@ if(MSVC AND BUILD_STATIC) add_dependencies(libzmq-static libzmq) endif() + +option(ENABLE_NO_EXPORT "Build with empty ZMQ_EXPORT macro, bypassing platform-based automated detection" OFF) +if(ENABLE_NO_EXPORT) + message(STATUS "Building with empty ZMQ_EXPORT macro") + add_definitions(-DZMQ_NO_EXPORT) +endif() diff --git a/configure.ac b/configure.ac index 5454f2a4..227e37b4 100644 --- a/configure.ac +++ b/configure.ac @@ -1150,6 +1150,11 @@ AC_ARG_WITH([pkgconfigdir], [pkgconfigdir='${libdir}/pkgconfig']) AC_SUBST([pkgconfigdir]) +AC_ARG_ENABLE([no-export], + [AS_HELP_STRING([--enable-no-export], + [Build libzmq with empty ZMQ_EXPORT macro, bypassing platform-based automated detection [default=no]])], + [CPPFLAGS="-DZMQ_NO_EXPORT $CPPFLAGS"]) + AC_CONFIG_FILES([ \ Makefile \ src/libzmq.pc \ diff --git a/include/zmq.h b/include/zmq.h index 2612c664..6becfa3e 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -59,6 +59,9 @@ extern "C" { #include /* Handle DSO symbol visibility */ +#if defined ZMQ_NO_EXPORT +#define ZMQ_EXPORT +#else #if defined _WIN32 #if defined ZMQ_STATIC #define ZMQ_EXPORT @@ -76,6 +79,7 @@ extern "C" { #define ZMQ_EXPORT #endif #endif +#endif /* Define integer types needed for event interface */ #define ZMQ_DEFINED_STDINT 1