[flac-dev] extend visibility attributes usage to osx builds

Ozkan Sezer sezeroz at gmail.com
Sun May 25 01:15:18 PDT 2014


The attached small configury patch extends visibility attributes usage
to darwin (osx) builds. Tested by cross-compiling on a linux host using
gcc-.4.0.2 and gcc-4.2.1 against 10.4 and 10.6 SDKs.

Regards.

--
O.S.
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index 6d0fa00..d3c302a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,7 +395,6 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
 	CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Wunreachable-code " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Winline -Wconversion
 	CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef -Wunreachable-code " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
 
-
 	XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
 	XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
 
@@ -409,6 +408,12 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
 		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
 		fi
 
+	if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
+		CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
+		CFLAGS="$CFLAGS -fvisibility=hidden"
+		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+		fi
+
 	if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
 		XIPH_ADD_CFLAGS([-fgnu89-inline])
 		fi


More information about the flac-dev mailing list