mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Hide symbols with gcc.
With gcc >= 4 and ELF, set default visibility to hidden and make visible only the symbols with FLAC_API or FLACPP_API. A convenience libFLAC-static.la is created for test_libFLAC as it depends on the hidden symbols.
This commit is contained in:
committed by
Erik de Castro Lopo
parent
18e01547ac
commit
19c78e58d7
@@ -360,9 +360,15 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
|
|||||||
if test x$enable_gcc_werror = "xyes" ; then
|
if test x$enable_gcc_werror = "xyes" ; then
|
||||||
CFLAGS="-Wall -Wextra -Werror $CFLAGS"
|
CFLAGS="-Wall -Wextra -Werror $CFLAGS"
|
||||||
CXXFLAGS="-Wall -Wextra -Werror $CXXFLAGS"
|
CXXFLAGS="-Wall -Wextra -Werror $CXXFLAGS"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
|
||||||
|
CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
|
||||||
|
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#@@@
|
#@@@
|
||||||
AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
|
AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
|
||||||
|
|||||||
@@ -55,17 +55,22 @@
|
|||||||
* \{
|
* \{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
|
#if defined(FLAC__NO_DLL)
|
||||||
#define FLACPP_API
|
#define FLACPP_API
|
||||||
|
|
||||||
#else
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
#ifdef FLACPP_API_EXPORTS
|
#ifdef FLACPP_API_EXPORTS
|
||||||
#define FLACPP_API _declspec(dllexport)
|
#define FLACPP_API _declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define FLACPP_API _declspec(dllimport)
|
#define FLACPP_API _declspec(dllimport)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(FLAC__USE_VISIBILITY_ATTR)
|
||||||
|
#define FLACPP_API __attribute__ ((visibility ("default")))
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define FLACPP_API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These #defines will mirror the libtool-based library version number, see
|
/* These #defines will mirror the libtool-based library version number, see
|
||||||
|
|||||||
@@ -55,17 +55,22 @@
|
|||||||
* \{
|
* \{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
|
#if defined(FLAC__NO_DLL)
|
||||||
#define FLAC_API
|
#define FLAC_API
|
||||||
|
|
||||||
#else
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
#ifdef FLAC_API_EXPORTS
|
#ifdef FLAC_API_EXPORTS
|
||||||
#define FLAC_API _declspec(dllexport)
|
#define FLAC_API _declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define FLAC_API _declspec(dllimport)
|
#define FLAC_API _declspec(dllimport)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(FLAC__USE_VISIBILITY_ATTR)
|
||||||
|
#define FLAC_API __attribute__ ((visibility ("default")))
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define FLAC_API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** These #defines will mirror the libtool-based library version number, see
|
/** These #defines will mirror the libtool-based library version number, see
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
|
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
|
||||||
lib_LTLIBRARIES = libFLAC.la
|
lib_LTLIBRARIES = libFLAC.la
|
||||||
|
noinst_LTLIBRARIES = libFLAC-static.la
|
||||||
if DEBUG
|
if DEBUG
|
||||||
DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT
|
DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT
|
||||||
endif
|
endif
|
||||||
@@ -106,7 +107,8 @@ extra_ogg_sources = \
|
|||||||
endif
|
endif
|
||||||
# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention
|
# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention
|
||||||
libFLAC_la_LDFLAGS = -version-info 10:0:2 $(LOCAL_EXTRA_LDFLAGS) @LT_NO_UNDEFINED@
|
libFLAC_la_LDFLAGS = -version-info 10:0:2 $(LOCAL_EXTRA_LDFLAGS) @LT_NO_UNDEFINED@
|
||||||
libFLAC_la_SOURCES = \
|
|
||||||
|
libFLAC_sources = \
|
||||||
bitmath.c \
|
bitmath.c \
|
||||||
bitreader.c \
|
bitreader.c \
|
||||||
bitwriter.c \
|
bitwriter.c \
|
||||||
@@ -125,3 +127,9 @@ libFLAC_la_SOURCES = \
|
|||||||
stream_encoder_framing.c \
|
stream_encoder_framing.c \
|
||||||
window.c \
|
window.c \
|
||||||
$(extra_ogg_sources)
|
$(extra_ogg_sources)
|
||||||
|
|
||||||
|
libFLAC_la_SOURCES = $(libFLAC_sources)
|
||||||
|
|
||||||
|
# needed for test_libFLAC
|
||||||
|
libFLAC_static_la_LIBADD = $(LOCAL_EXTRA_LIBADD)
|
||||||
|
libFLAC_static_la_SOURCES = $(libFLAC_sources)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ test_libFLAC_LDADD = \
|
|||||||
$(top_builddir)/src/share/grabbag/libgrabbag.la \
|
$(top_builddir)/src/share/grabbag/libgrabbag.la \
|
||||||
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
|
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
|
||||||
$(top_builddir)/src/test_libs_common/libtest_libs_common.la \
|
$(top_builddir)/src/test_libs_common/libtest_libs_common.la \
|
||||||
$(top_builddir)/src/libFLAC/libFLAC.la \
|
$(top_builddir)/src/libFLAC/libFLAC-static.la \
|
||||||
@OGG_LIBS@ \
|
@OGG_LIBS@ \
|
||||||
-lm
|
-lm
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user