--- src/compiler.h (revision 113) +++ src/compiler.h (revision 114) @@ -26,7 +26,9 @@ extern "C" { #endif -#if defined(__GNUC__) && __GNUC__ >= 4 +#include + +#ifdef HAVE_VISIBILITY_HIDDEN # define EXPORT_SYMBOL __attribute__((visibility("default"))) #else # define EXPORT_SYMBOL --- src/Makefile.am (revision 113) +++ src/Makefile.am (revision 114) @@ -36,7 +36,11 @@ INCLUDES = -I$(srcdir)/../include -AM_CFLAGS = $(GLIB_CFLAGS) -DG_DISABLE_DEPRECATED -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -Wall -Waggregate-return -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Winline -pipe $(FVISIBILITY) +AM_CFLAGS = $(GLIB_CFLAGS) -DG_DISABLE_DEPRECATED \ + -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 \ + -D_REENTRANT -Wall -Waggregate-return -Wmissing-declarations \ + -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \ + -Winline -pipe @GCC_FVISIBILITY_HIDDEN@ install-data-hook: ( \ --- configure.ac (revision 113) +++ configure.ac (revision 114) @@ -48,20 +48,30 @@ AC_PROG_CC # GCC 4.x -fvisibility=hidden { -FVISIBILITY="" +AC_DEFUN([CHECK_GCC_FVISIBILITY], +[ AC_LANG_PUSH(C) -saved_cflags="$CFLAGS" -CFLAGS="$CFLAGS -fvisibility=hidden" -AC_CACHE_CHECK([whether $CC supports -fvisibility=hidden], [ac_cv_gcc_fvis], - [AC_COMPILE_IFELSE([ ], [ac_cv_gcc_fvis=yes], [ac_cv_gcc_fvis=no])]) -CFLAGS="$saved_cflags" -if test "$ac_cv_gcc_fvis" = yes; then - FVISIBILITY="-fvisibility=hidden" -else - FVISIBILITY="" +saved_CFLAGS="$CFLAGS" +CFLAGS="$saved_CFLAGS -fvisibility=hidden" +AC_CACHE_CHECK([whether compiler accepts -fvisibility=hidden], +[cv_fvisibility_hidden], + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM( + [], + []), + [cv_fvisibility_hidden=yes], + [cv_fvisibility_hidden=no] + ) +) +if test "$cv_fvisibility_hidden" = "yes"; then +AC_DEFINE(HAVE_VISIBILITY_HIDDEN, [], + [True if compiler supports -fvisibility=hidden]) +AC_SUBST(GCC_FVISIBILITY_HIDDEN, [-fvisibility=hidden]) fi -AC_SUBST(FVISIBILITY) +CFLAGS="$saved_CFLAGS" AC_LANG_POP(C) +])dnl +CHECK_GCC_FVISIBILITY() # } AC_PROG_INSTALL