- Let the user disable the new GCC 4.0 visibility support

from configure. This is mainly there for buggy compilers / binutils.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@715 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-04 22:17:02 +00:00
parent 4108b39c09
commit fcc9e93827
5 changed files with 103 additions and 53 deletions

View file

@ -100,6 +100,7 @@ PKG_CHECK_MODULES([LIBXML2],
[libxml-2.0 >= $LIBXML2_VERSION],
:, AC_MSG_ERROR([$LIBXML2_PKG_ERRORS]))
dnl use DSO visibility tags for systems that supports it correctly
dnl (for example, GCC 4.0 and above)
dnl see http://gcc.gnu.org/wiki/Visibility for more informations
@ -108,18 +109,31 @@ AH_TEMPLATE([SG_DLLIMPORT],[Attribute for objects to be imported from DSOs])
AH_TEMPLATE([SG_DLLLOCAL], [Attribute for objects local to current DSO])
AH_TEMPLATE([SG_DLLPUBLIC],[Attribute for DSO public objects])
AC_ARG_ENABLE([visibility-support],
AS_HELP_STRING([--disable-visibility-support],
[disable the new GCC visibility support]),
[enable_gcc_visibility="$enableval"],
[enable_gcc_visibility="yes"])
AC_MSG_CHECKING([whether to use new GCC visibility attributes])
dnl for now it works only with GCC >= 4.0.0
AC_MSG_CHECKING([whether GCC supports DSO visibility attributes])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [
#if defined __GNUC__ && (__GNUC__) >= 4
return 0;
#else
bails out with a compilation error.
#endif
]),[
AC_MSG_RESULT([yes])
if test "x$enable_gcc_visibility" = "xyes"; then
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [
#if defined __GNUC__ && (__GNUC__) >= 4
return 0;
#else
bails out with a compilation error.
#endif
]),
:,
[enable_gcc_visibility="no"])
fi
AC_LANG_POP
if test "x$enable_gcc_visibility" = "xyes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([SG_DLLIMPORT],[/* intentionally left with no value */])
AC_DEFINE([SG_DLLEXPORT],[__attribute__ ((visibility("default")))])
AC_DEFINE([SG_DLLLOCAL],[__attribute__ ((visibility("hidden")))])
@ -128,14 +142,14 @@ AC_COMPILE_IFELSE(
AC_CHECK_CXXFLAG([VISIB_HIDDEN], [fvisibility=hidden])
AC_SUBST([VISIB_HIDDEN])
AC_CHECK_CXXFLAG([CXXFLAGS],[fvisibility-inlines-hidden])
],[
else
AC_MSG_RESULT([no])
AC_DEFINE([SG_DLLIMPORT],[/* unsupported */])
AC_DEFINE([SG_DLLEXPORT],[/* unsupported */])
AC_DEFINE([SG_DLLLOCAL],[/* unsupported */])
AC_DEFINE([SG_DLLPUBLIC],[/* unsupported */])
])
AC_LANG_POP
fi
dnl see if we've to compile tests
AC_MSG_CHECKING([whether tests have to be built])