summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--include/libirecovery.h14
-rw-r--r--src/libirecovery.c12
3 files changed, 21 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 2b12d8f..fdecca3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,6 +141,11 @@ AS_IF([test "x$with_dummy" = "xyes"], [
])
AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden")
+
+if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then
+ GLOBAL_CFLAGS+=" -DIRECV_STATIC"
+fi
+
AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(GLOBAL_LDFLAGS)
diff --git a/include/libirecovery.h b/include/libirecovery.h
index 9909f04..f6b9971 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -27,17 +27,11 @@ extern "C" {
#include <stdint.h>
-#ifdef IRECV_STATIC
- #define IRECV_API
-#elif defined(_WIN32)
- #ifdef DLL_EXPORT
- #define IRECV_API __declspec(dllexport)
- #else
+#ifndef IRECV_API
+ #ifdef IRECV_STATIC
+ #define IRECV_API
+ #elif defined(_WIN32)
#define IRECV_API __declspec(dllimport)
- #endif
-#else
- #if __GNUC__ >= 4
- #define IRECV_API __attribute__((visibility("default")))
#else
#define IRECV_API
#endif
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 9742cb5..e38cdd6 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -57,6 +57,18 @@
#endif
#endif
+#ifdef IRECV_STATIC
+ #define IRECV_API
+#elif defined(_WIN32)
+ #define IRECV_API __declspec( dllexport )
+#else
+ #if __GNUC__ >= 4
+ #define IRECV_API __attribute__((visibility("default")))
+ #else
+ #define IRECV_API
+ #endif
+#endif
+
#include "libirecovery.h"
struct irecv_client_private {