Fix visibility on rhel4

Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
This commit is contained in:
Mikko Koppanen 2010-12-07 11:14:46 +01:00 committed by Martin Sustrik
parent 9bb5323a1a
commit aed2eeafdc
2 changed files with 53 additions and 11 deletions

View File

@ -67,6 +67,22 @@ AC_DEFUN([AC_ZMQ_CHECK_LANG_CLANG],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="no" ; $2])
])])
dnl ##############################################################################
dnl # AC_ZMQ_CHECK_LANG_GCC4([action-if-found], [action-if-not-found]) #
dnl # Check if the current language is compiled using clang #
dnl ##############################################################################
AC_DEFUN([AC_ZMQ_CHECK_LANG_GCC4],
[AC_CACHE_CHECK([whether we are using gcc >= 4 _AC_LANG compiler],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler],
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if (!defined __GNUC__ || __GNUC__ < 4)
error if not gcc4 or higher
#endif
]])],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="yes" ; $1],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="no" ; $2])
])])
dnl ##############################################################################
dnl # AC_ZMQ_CHECK_DOC_BUILD #
dnl # Check whether to build documentation and install man-pages #
@ -142,6 +158,7 @@ AC_DEFUN([AC_ZMQ_CHECK_COMPILERS], [{
AC_ZMQ_CHECK_LANG_ICC
AC_ZMQ_CHECK_LANG_SUN_STUDIO
AC_ZMQ_CHECK_LANG_CLANG
AC_ZMQ_CHECK_LANG_GCC4
AC_LANG_POP([C])
AC_LANG_PUSH(C++)
@ -150,6 +167,7 @@ AC_DEFUN([AC_ZMQ_CHECK_COMPILERS], [{
AC_ZMQ_CHECK_LANG_ICC
AC_ZMQ_CHECK_LANG_SUN_STUDIO
AC_ZMQ_CHECK_LANG_CLANG
AC_ZMQ_CHECK_LANG_GCC4
AC_LANG_POP([C++])
# Set GCC and GXX variables correctly
@ -173,6 +191,8 @@ dnl # Sets ac_zmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
dnl ############################################################################
AC_DEFUN([AC_ZMQ_CHECK_LANG_FLAG], [{
AC_REQUIRE([AC_PROG_GREP])
AC_MSG_CHECKING([whether _AC_LANG compiler supports $1])
ac_zmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_c_werror_flag
@ -195,8 +215,8 @@ AC_DEFUN([AC_ZMQ_CHECK_LANG_FLAG], [{
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
# This hack exist for ICC, which outputs unknown options as remarks
# Remarks are not turned into errors even with -Werror on
[if (grep 'ignoring unknown' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then
[if ($GREP 'ignoring unknown' conftest.err ||
$GREP 'not supported' conftest.err) >/dev/null 2>&1; then
eval AS_TR_SH(ac_zmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"
else
eval AS_TR_SH(ac_zmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="yes"
@ -494,3 +514,27 @@ AC_DEFUN([AC_ZMQ_CHECK_LANG_PRAGMA], [{
AS_IF([eval test x$]AS_TR_SH(ac_zmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)[ = "xyes"],
[$2], [$3])
}])
dnl ################################################################################
dnl # AC_ZMQ_CHECK_LANG_VISIBILITY([action-if-found], [action-if-not-found]) #
dnl # Check if the compiler supports dso visibility #
dnl ################################################################################
AC_DEFUN([AC_ZMQ_CHECK_LANG_VISIBILITY], [{
ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag=""
if test "x$ac_zmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
"x$ac_zmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes" -o \
"x$ac_zmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler" = "xyes"; then
AC_ZMQ_CHECK_LANG_FLAG([-fvisibility=hidden],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-fvisibility=hidden"])
elif test "x$ac_zmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
AC_ZMQ_CHECK_LANG_FLAG([-xldscope=hidden],
[ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-xldscope=hidden"])
fi
AC_MSG_CHECKING(whether _AC_LANG compiler supports dso visibility)
AS_IF([test "x$ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag" != "x"],
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])

View File

@ -56,6 +56,9 @@ ac_zmq_pedantic="yes"
# By default compiling with -Werror except OSX.
ac_zmq_werror="yes"
# By default use DSO visibility
ac_zmq_dso_visibility="yes"
# Whether we are on mingw or not.
ac_zmq_on_mingw32="no"
@ -175,6 +178,7 @@ case "${host_os}" in
AC_ZMQ_CHECK_LANG_FLAG_PREPEND([-Wno-long-long])
AC_LANG_POP([C++])
ac_zmq_on_mingw32="yes"
ac_zmq_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
AC_MSG_ERROR([Building static libraries is not supported under MinGW32])
@ -202,19 +206,13 @@ esac
#
# Check if the compiler supports -fvisibility=hidden flag. MinGW32 uses __declspec
#
if test "x$ac_zmq_on_mingw32" != "xyes"; then
if test "x$ac_zmq_dso_visibility" = "xyes"; then
AC_LANG_PUSH([C])
AC_ZMQ_CHECK_LANG_FLAG([-fvisibility=hidden],
[LIBZMQ_EXTRA_CFLAGS="-fvisibility=hidden ${LIBZMQ_EXTRA_CFLAGS}"],
[AC_ZMQ_CHECK_LANG_FLAG([-xldscope=hidden],
[LIBZMQ_EXTRA_CFLAGS="-xldscope=hidden ${LIBZMQ_EXTRA_CFLAGS}"])])
AC_ZMQ_CHECK_LANG_VISIBILITY([LIBZMQ_EXTRA_CFLAGS="$ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag ${LIBZMQ_EXTRA_CFLAGS}"])
AC_LANG_POP([C])
AC_LANG_PUSH([C++])
AC_ZMQ_CHECK_LANG_FLAG([-fvisibility=hidden],
[LIBZMQ_EXTRA_CXXFLAGS="-fvisibility=hidden ${LIBZMQ_EXTRA_CXXFLAGS}"],
[AC_ZMQ_CHECK_LANG_FLAG([-xldscope=hidden],
[LIBZMQ_EXTRA_CXXFLAGS="-xldscope=hidden ${LIBZMQ_EXTRA_CXXFLAGS}"])])
AC_ZMQ_CHECK_LANG_VISIBILITY([LIBZMQ_EXTRA_CXXFLAGS="$ac_zmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag ${LIBZMQ_EXTRA_CXXFLAGS}"])
AC_LANG_POP([C++])
fi