File libdiscid-0.2.1-visibility.patch of Package libdiscid
Index: include/discid/discid.h
===================================================================
--- include/discid/discid.h.orig 2008-03-13 07:17:20.000000000 +0100
+++ include/discid/discid.h 2009-10-07 17:28:46.797921000 +0200
@@ -24,13 +24,7 @@
#ifndef MUSICBRAINZ_DISC_ID_H
#define MUSICBRAINZ_DISC_ID_H
-#ifdef WIN32
-# ifdef libdiscid_EXPORTS
-# define LIBDISCID_API __declspec(dllexport)
-# else
-# define LIBDISCID_API __declspec(dllimport)
-# endif
-#else
+#ifndef LIBDISCID_API
# define LIBDISCID_API
#endif
Index: configure.ac
===================================================================
--- configure.ac.orig 2008-03-13 07:17:22.000000000 +0100
+++ configure.ac 2009-10-07 17:30:29.284843000 +0200
@@ -53,6 +53,45 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -O2"
fi
+dnl ************************************************************
+dnl Enable hiding of internal symbols in library to reduce its size and
+dnl speed dynamic linking of applications. This currently is only supported
+dnl on gcc >= 4.0 and SunPro C.
+dnl
+AC_MSG_CHECKING([whether to enable hidden symbols in the library])
+AC_ARG_ENABLE(hidden-symbols,
+AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
+AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
+[ case "$enableval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_CHECKING([whether $CC supports it])
+ if test "$GCC" = yes ; then
+ if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(LIBDISCID_API, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ else
+ dnl Test for SunPro cc
+ if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(LIBDISCID_API, [__global], [to make a symbol visible])
+ CFLAGS="$CFLAGS -xldscope=hidden"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
AC_OUTPUT([
Makefile src/Makefile include/Makefile include/discid/Makefile