From 3daee6097cfa14c597e5104b02acfe83749001d9 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 29 Jan 2024 10:45:41 +0100 Subject: Fix PLIST_API definitions --- configure.ac | 12 +++++++++++- include/plist/plist.h | 14 ++++---------- src/Array.cpp | 6 +++--- src/Boolean.cpp | 1 + src/Dictionary.cpp | 1 + src/Integer.cpp | 1 + src/Key.cpp | 1 + src/Makefile.am | 1 + src/Node.cpp | 1 + src/String.cpp | 1 + src/Structure.cpp | 1 + src/Uid.cpp | 1 + src/bplist.c | 2 +- src/plist.h | 16 ++++++++++++++-- 14 files changed, 42 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index c6cb4bc..bf1131d 100644 --- a/configure.ac +++ b/configure.ac @@ -174,7 +174,7 @@ else fi AM_CONDITIONAL([HAVE_CYTHON],[test "x$cython_python_bindings" = "xyes"]) -AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing -fvisibility=hidden $PTHREAD_CFLAGS") +AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing $PTHREAD_CFLAGS") GLOBAL_LDFLAGS="$PTHREAD_LIBS" AC_ARG_ENABLE(debug, @@ -192,7 +192,17 @@ if (test "x$debug" = "xyes"); then GLOBAL_CFLAGS+=" -g" fi +if test "x$enable_static" = "xyes" -a "x$enable_shared" = "xno"; then + GLOBAL_CFLAGS+=" -DLIBPLIST_STATIC" +fi + +GLOBAL_CXXFLAGS=$GLOBAL_CFLAGS +AS_COMPILER_FLAG([-fvisibility=hidden], [ + GLOBAL_CFLAGS+=" -fvisibility=hidden" +], []) + AC_SUBST(GLOBAL_CFLAGS) +AC_SUBST(GLOBAL_CXXFLAGS) AC_SUBST(GLOBAL_LDFLAGS) case "$GLOBAL_CFLAGS" in diff --git a/include/plist/plist.h b/include/plist/plist.h index 47eda51..0a9f5ee 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h @@ -75,17 +75,11 @@ extern "C" #endif /*}}}*/ -#ifdef LIBPLIST_STATIC - #define PLIST_API -#elif defined(_WIN32) - #ifdef DLL_EXPORT - #define PLIST_API __declspec(dllexport) - #else +#ifndef PLIST_API + #ifdef LIBPLIST_STATIC + #define PLIST_API + #elif defined(_WIN32) #define PLIST_API __declspec(dllimport) - #endif -#else - #if __GNUC__ >= 4 - #define PLIST_API __attribute__((visibility("default"))) #else #define PLIST_API #endif diff --git a/src/Array.cpp b/src/Array.cpp index d86d021..bc448d3 100644 --- a/src/Array.cpp +++ b/src/Array.cpp @@ -18,11 +18,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - +#include #include #include -#include +#include "plist.h" +#include namespace PList { diff --git a/src/Boolean.cpp b/src/Boolean.cpp index 2c871c8..9ec1a63 100644 --- a/src/Boolean.cpp +++ b/src/Boolean.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 4e7e19c..30c20b6 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Integer.cpp b/src/Integer.cpp index 7fa0f93..30a5405 100644 --- a/src/Integer.cpp +++ b/src/Integer.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Key.cpp b/src/Key.cpp index 5f8d205..79265d5 100644 --- a/src/Key.cpp +++ b/src/Key.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Makefile.am b/src/Makefile.am index e4b39ae..1a416ad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,6 +4,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/libcnary/include AM_CFLAGS = $(GLOBAL_CFLAGS) +AM_CXXFLAGS = $(GLOBAL_CXXFLAGS) AM_LDFLAGS = $(GLOBAL_LDFLAGS) lib_LTLIBRARIES = \ diff --git a/src/Node.cpp b/src/Node.cpp index 08a91b0..0bd428a 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include #include #include diff --git a/src/String.cpp b/src/String.cpp index aee2358..2ddc28b 100644 --- a/src/String.cpp +++ b/src/String.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Structure.cpp b/src/Structure.cpp index 4be4e7d..670cce6 100644 --- a/src/Structure.cpp +++ b/src/Structure.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/Uid.cpp b/src/Uid.cpp index e83ed27..8c73c80 100644 --- a/src/Uid.cpp +++ b/src/Uid.cpp @@ -19,6 +19,7 @@ */ #include +#include "plist.h" #include namespace PList diff --git a/src/bplist.c b/src/bplist.c index 953c2c7..93f0bc6 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -32,11 +32,11 @@ #include #include -#include #include "plist.h" #include "hashtable.h" #include "bytearray.h" #include "ptrarray.h" +#include "plist/plist.h" #include diff --git a/src/plist.h b/src/plist.h index 178fb7c..a993e3a 100644 --- a/src/plist.h +++ b/src/plist.h @@ -26,8 +26,6 @@ #include #endif -#include "plist/plist.h" - #include #include @@ -39,6 +37,20 @@ #include #endif +#ifdef LIBPLIST_STATIC + #define PLIST_API +#elif defined(_WIN32) + #define PLIST_API __declspec( dllexport ) +#else + #if __GNUC__ >= 4 + #define PLIST_API __attribute__((visibility("default"))) + #else + #define PLIST_API + #endif +#endif + +#include "plist/plist.h" + struct plist_data_s { union -- cgit v1.1-32-gdbae