diff oct-conf-post.in.h @ 29313:6dea3b384846

Optionally disable building libraries with visibility attributes (bug #59820). * configure.ac: Add argument --disable-lib-visibility-flags to manually disable building and linking Octave libraries with visibility attributes. * Makefile.am: Use compiler flags for symbol visibility according to configure result. * oct-conf-post.in.h, build-aux/mk-octave-config-h.sh: Set preprocessor macros with visibility attributes to empty optionally.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 23 Jan 2021 10:54:47 +0100
parents f6058c6e1b18
children 7854d5752dd2
line wrap: on
line diff
--- a/oct-conf-post.in.h	Sat Jan 23 11:27:46 2021 +0100
+++ b/oct-conf-post.in.h	Sat Jan 23 10:54:47 2021 +0100
@@ -170,19 +170,24 @@
 
 /* oct-dlldefs.h */
 
-#if defined (_WIN32) || defined (__CYGWIN__)
-#  if defined (__GNUC__)
-     /* GCC */
-#    define OCTAVE_EXPORT __attribute__ ((dllexport))
-#    define OCTAVE_IMPORT __attribute__ ((dllimport))
+#if defined (OCTAVE_ENABLE_LIB_VISIBILITY_FLAGS)
+#  if defined (_WIN32) || defined (__CYGWIN__)
+#    if defined (__GNUC__)
+       /* GCC */
+#      define OCTAVE_EXPORT __attribute__ ((dllexport))
+#      define OCTAVE_IMPORT __attribute__ ((dllimport))
+#    else
+       /* MSVC */
+#      define OCTAVE_EXPORT __declspec(dllexport)
+#      define OCTAVE_IMPORT __declspec(dllimport)
+#    endif
 #  else
-     /* MSVC */
-#    define OCTAVE_EXPORT __declspec(dllexport)
-#    define OCTAVE_IMPORT __declspec(dllimport)
+     /* All other platforms. */
+#    define OCTAVE_EXPORT __attribute__ ((visibility ("default")))
+#    define OCTAVE_IMPORT
 #  endif
 #else
-   /* All other platforms. */
-#  define OCTAVE_EXPORT __attribute__ ((visibility ("default")))
+#  define OCTAVE_EXPORT
 #  define OCTAVE_IMPORT
 #endif