LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File libdiscid-visibility.patch of Package libdiscid (Project multimedia:libs)

diff --git a/configure.ac b/configure.ac
index c44a656..40b49d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,8 +39,10 @@ AC_MSG_NOTICE([using discid implementation disc_${os}.c])
 
 
 dnl Checks for programs.
-AC_PROG_CC
-AM_PROG_LIBTOOL
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+LT_INIT([disable-static pic-only])
 AC_SUBST(LIBTOOL_DEPS)  
 AC_PROG_INSTALL
 
@@ -50,9 +52,44 @@ AC_C_BIGENDIAN
 AC_CHECK_SIZEOF(long)
 
 
-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([
diff --git a/include/discid/discid.h b/include/discid/discid.h
index 9425689..ad5a210 100644
--- a/include/discid/discid.h
+++ b/include/discid/discid.h
@@ -24,13 +24,7 @@
 #ifndef MUSICBRAINZ_DISC_ID_H
 #define MUSICBRAINZ_DISC_ID_H
 
-#if (defined(_WIN32) || defined(_WIN64))
-#	ifdef libdiscid_EXPORTS
-#		define LIBDISCID_API __declspec(dllexport)
-#	else
-#		define LIBDISCID_API __declspec(dllimport)
-#	endif
-#else
+#ifndef LIBDISCID_API
 #	define LIBDISCID_API
 #endif
 
diff --git a/src/Makefile.am b/src/Makefile.am
index b59991d..c8fbee3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,7 @@ EXTRA_libdiscid_la_SOURCES = \
 	disc_linux.c disc_win32.c disc_win32_new.c \
 	disc_darwin.c disc_freebsd.c disc_solaris.c disc_openbsd.c
 
-AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_CPPFLAGS = -include $(top_builddir)/config.h -I$(top_srcdir)/include
 libdiscid_la_LIBADD = @DISC_OS_OBJ@
 libdiscid_la_DEPENDENCIES = @DISC_OS_OBJ@