File libbraille-0.19.0-visibility.patch of Package libbraille

Index: configure.ac
===================================================================
--- configure.ac.orig	2006-03-04 01:31:27.000000000 +0100
+++ configure.ac	2009-10-07 01:53:26.000000000 +0200
@@ -208,6 +208,44 @@ AC_SUBST(JAVA_INC)
 AC_SUBST(JAVA_INC_NATIVE)
 AM_CONDITIONAL(JAVAWRAPPER, test x$enable_java = xyes)
 
+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(BRAILLE_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(BRAILLE_API, [__global], [to make a symbol visible])
+           CFLAGS="$CFLAGS -xldscope=hidden"
+         else
+           AC_MSG_RESULT(no)
+         fi
+       fi
+       ;;
+  esac ],
+       AC_MSG_RESULT(no)
+)
 # Finally create all the generated files
 # The configure script takes "file.in" and substitutes variables to produce
 # "file".  In this case we are just generating the Makefiles, but this could
Index: include/braille.h
===================================================================
--- include/braille.h.orig	2006-03-04 01:31:25.000000000 +0100
+++ include/braille.h	2009-10-07 02:08:27.000000000 +0200
@@ -25,13 +25,7 @@ extern "C" {
 // that uses this DLL. This way any other project whose source files include this file see 
 // LIBBRAILLE_API functions as being imported from a DLL, wheras this DLL sees symbols
 // defined with this macro as being exported.
-#ifdef WIN32
-#ifdef LIBBRAILLE_EXPORTS
-#define BRAILLE_API __declspec(dllexport)
-#else
-#define BRAILLE_API __declspec(dllimport)
-#endif
-#else
+#ifndef BRAILLE_API
 #define BRAILLE_API
 #endif