shithub: libdvdcss

Download patch

ref: 31bf1942f771409e9375a4daf8a53b309cd3a088
parent: 5c8ae97ccd0b5ee13c66f249efb630645622eaf9
author: Jean-Baptiste Kempf <jb@videolan.org>
date: Wed Aug 29 04:57:27 EDT 2012

Support ELF visibility attribute




--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,24 @@
 CFLAGS="${CFLAGS_save}"
 
 dnl
+dnl  Check if the compiler supports ELF visibility
+dnl
+CFLAGS_save="$CFLAGS"
+
+AC_CACHE_CHECK([if \$CC supports ELF visibility],
+    [ac_cv_c_visibility],
+    [CFLAGS="-fvisibility=hidden ${CFLAGS_save}"
+     AC_TRY_COMPILE([],
+                    [__attribute__((visibility("default"))) extern int visible],
+                    ac_cv_c_visibility=yes, ac_cv_c_visibility=no)])
+if test "${ac_cv_c_visibility}" != "no"; then
+    CFLAGS_save="-fvisibility=hidden ${CFLAGS_save}";
+    AC_DEFINE(HAVE_VISIBILITY, 1, Support ELF visibility.)
+fi
+
+CFLAGS="${CFLAGS_save}"
+
+dnl
 dnl  Use 64 bits offsets
 dnl
 CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DDVDCSS_DIST ${CFLAGS}"
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -60,6 +60,8 @@
 #define LIBDVDCSS_EXPORT __declspec(dllexport) extern
 #elif defined(LIBDVDCSS_IMPORTS)
 #define LIBDVDCSS_EXPORT __declspec(dllimport) extern
+#elif defined(HAVE_VISIBILITY)
+#define LIBDVDCSS_EXPORT __attribute__((visibility("default"))) extern
 #else
 #define LIBDVDCSS_EXPORT extern
 #endif