diff options
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | include/libirecovery.h | 14 | ||||
-rw-r--r-- | src/libirecovery.c | 12 |
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"], [ | |||
141 | ]) | 141 | ]) |
142 | 142 | ||
143 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden") | 143 | AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden") |
144 | |||
145 | if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then | ||
146 | GLOBAL_CFLAGS+=" -DIRECV_STATIC" | ||
147 | fi | ||
148 | |||
144 | AC_SUBST(GLOBAL_CFLAGS) | 149 | AC_SUBST(GLOBAL_CFLAGS) |
145 | AC_SUBST(GLOBAL_LDFLAGS) | 150 | AC_SUBST(GLOBAL_LDFLAGS) |
146 | 151 | ||
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" { | |||
27 | 27 | ||
28 | #include <stdint.h> | 28 | #include <stdint.h> |
29 | 29 | ||
30 | #ifdef IRECV_STATIC | 30 | #ifndef IRECV_API |
31 | #define IRECV_API | 31 | #ifdef IRECV_STATIC |
32 | #elif defined(_WIN32) | 32 | #define IRECV_API |
33 | #ifdef DLL_EXPORT | 33 | #elif defined(_WIN32) |
34 | #define IRECV_API __declspec(dllexport) | ||
35 | #else | ||
36 | #define IRECV_API __declspec(dllimport) | 34 | #define IRECV_API __declspec(dllimport) |
37 | #endif | ||
38 | #else | ||
39 | #if __GNUC__ >= 4 | ||
40 | #define IRECV_API __attribute__((visibility("default"))) | ||
41 | #else | 35 | #else |
42 | #define IRECV_API | 36 | #define IRECV_API |
43 | #endif | 37 | #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 @@ | |||
57 | #endif | 57 | #endif |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifdef IRECV_STATIC | ||
61 | #define IRECV_API | ||
62 | #elif defined(_WIN32) | ||
63 | #define IRECV_API __declspec( dllexport ) | ||
64 | #else | ||
65 | #if __GNUC__ >= 4 | ||
66 | #define IRECV_API __attribute__((visibility("default"))) | ||
67 | #else | ||
68 | #define IRECV_API | ||
69 | #endif | ||
70 | #endif | ||
71 | |||
60 | #include "libirecovery.h" | 72 | #include "libirecovery.h" |
61 | 73 | ||
62 | struct irecv_client_private { | 74 | struct irecv_client_private { |